In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "solution to errors caused by too many operating files in the Linux system". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the solution to errors caused by too many operating files in the Linux system.
Too many open files solution to the number of files opened by linux
The reason for this prompt in too many open files is that the number of file / socket connections opened by the program exceeds the system setting value.
View the maximum number of files allowed to open per user
The code is as follows:
Ulimit-a
Fdipzone@ubuntu:~$ ulimit-a
Core file size (blocks,-c) 0
Data seg size (kbytes,-d) unlimited
Scheduling priority (- e) 20
File size (blocks,-f) unlimited
Pending signals (- I) 16382
Max locked memory (kbytes,-l) 64
Max memory size (kbytes,-m) unlimited
Open files (- n) 1024
Pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-Q) 819200
Real-time priority (- r) 0
Stack size (kbytes,-s) 8192
Cpu time (seconds,-t) unlimited
Max user processes (- u) unlimited
Virtual memory (kbytes,-v) unlimited
File locks (- x) unlimited
Where open files (- n) 1024 indicates that the maximum number of files allowed to open per user is 1024
View the number of files currently open by the system
The code is as follows:
Lsof | wc-l
Watch "lsof | wc-l"
Check the number of open files for a process
The code is as follows:
Lsof-p pid | wc-l
Lsof-p 1234 | wc-l
Set open files numerical method
The code is as follows:
Ulimit-n 2048
Fdipzone@ubuntu:~$ ulimit-n 2048
Fdipzone@ubuntu:~$ ulimit-a
Core file size (blocks,-c) 0
Data seg size (kbytes,-d) unlimited
Scheduling priority (- e) 20
File size (blocks,-f) unlimited
Pending signals (- I) 16382
Max locked memory (kbytes,-l) 64
Max memory size (kbytes,-m) unlimited
Open files (- n) 2048
Pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-Q) 819200
Real-time priority (- r) 0
Stack size (kbytes,-s) 8192
Cpu time (seconds,-t) unlimited
Max user processes (- u) unlimited
Virtual memory (kbytes,-v) unlimited
File locks (- x) unlimited
In this way, the maximum number of files allowed to be opened by the current user can be set to 2048, but this setting method will revert to the default value after restart.
Permanent setting method
The code is as follows:
Vim / etc/security/limits.conf
Join at the end
The code is as follows:
* soft nofile 4096
* hard nofile 4096
The first * represents all users, and a user can be set up as needed, such as
The code is as follows:
Fdipzone soft nofile 8192
Fdipzone hard nofile 8192
After the change, the cancellation will take effect.
Solutions to linux Argument list too long errors
The last time you need to delete all the files in the / tmp directory, the number of files is relatively large.
The code is as follows:
Ls-lt / tmp | wc-l
385412
After using rm *, the system prompts an error Argument list too long
The reason is that under linux, trying to pass too many parameters to a system command (ls *; cp *; rm *; cat *; etc..) An Argument list too long error occurs.
The solution is as follows:
Use find-exec to traverse, and then perform the deletion.
The code is as follows:
Sudo find / tmp-type f-exec rm {}\
Thank you for your reading, the above is the content of "the wrong solution caused by too many operating files in the Linux system". After the study of this article, I believe you have a deeper understanding of the problem that the excessive number of operating files in the Linux system leads to wrong solutions, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.