In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you what are the common query handle commands in Linux, which are concise and easy to understand, which can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Query the total number of handles occupied by command processes lsof-n | wc-l to see which process occupies the most handles lsof-n | awk'{print $2}'| sort | uniq-c | sort-nr | more
The first column is the number of occupied handles; the second column is the process number PID
| query the occupied handle of a process lsof | grep PID |
First column: process name second column: PID third column: process owner fourth column: file descriptor fifth column: file type
Linux setting handle command method 1
Step 1: modify the linux system parameters. Vi / etc/security/limits.conf add
* soft nofile 65535 * hard nofile 65535
Here * means all users, but some systems do not recognize them and require specific user names, such as:
Root soft nofile 65535 root hard nofile 65535
Step 2: edit the etc/pam.d/login to make sure it looks like the following line:
Session required pam_limits.so
Step 3: save after modification, log out of the current user, and log in again
Step 4: verify. Use the ulimit-Hn and ulimit-Sn commands to view the current process user's hard and soft limits, respectively.
Or after the current user starts a program, through cat / proc//limits (pid belongs to that process, or the pid of any of its child processes)
Method 2 ulimit-HSn 65536
Simply execute this command, which is valid only in the current reply. If you want to save it permanently, you can modify the .bash _ profile file and / etc/profile to add the above command to the end.
Appendix
Ulimit-a view the current user's file handle restrictions
Ulimit-a
Limit the number of handles at the user level.
Modify / etc/security/limits.conf to add the following code: user name (or * for all users) soft nofile 65535
User name hard nofile 65535 has two restrictions, one is the soft soft limit, when the number exceeds the soft limit, the system will give warning warning, but when the hard hard limit is reached, the system will reject or exception. After modification, you may need to restart shell to take effect.
The number of handles at the system level is limited.
Sysctl-w fs.file-max 65536
Or
Echo "65536" > / proc/sys/fs/file-max
The function of the two is the same, the former changes the kernel parameters, while the latter directly acts on the corresponding files of the kernel parameters on the virtual file system (procfs, psuedo file system). You can view the new restrictions with the following command
Sysctl-a | grep fs.file-max
Or
Cat / proc/sys/fs/file-max
Modify kernel parameters
/ etc/sysctl.confecho "fs.file-max=65536" > > / etc/sysctl.confsysctl-p
View the system total limit command:
Cat / proc/sys/fs/file-max
View the number of file handles currently used by the entire system command:
Cat / proc/sys/fs/file-nr
See which handles are opened by a process:
Lsof-p pid
A process opened several handles:
Lsof-p pid | wc-l
You can also see what process a directory / file is occupied by, displaying all process information about the directory or file that has been opened:
The above contents of lsof path/filename are the commands of common query handles in Linux. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.