Home IT Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ The wrong in Linux: too many open files     - The Java utility, JavaMail (Programming)

- CentOS achieve trash mechanism (Linux)

- Process monitoring tools Supervisor start MongoDB (Database)

- How to view information about the installed version of CentOS (Linux)

- iOS GCD multithreading simple to use (Programming)

- CentOS 6.5 install Firefox (Linux)

- Linux system performance analysis and top command ps.pstree Comments (Linux)

- Linux common network tools: batch scanning of hosting services netcat (Linux)

- Installing PHP Memcache extension under Linux (Server)

- Swift string common method (Programming)

- Fedora 22 Server how to upgrade to Fedora 23 Beta Server (Linux)

- With screenfetch linux logo and basic hardware information display with cool Linux logo (Linux)

- Linux system monitoring tool set cpu (Linux)

- Ceph performance optimization summary (v0.94) (Server)

- CentOS 6.6 install Oracle 11gR2 database (Database)

- Nginx-1.9.7 TCP reverse proxy (Server)

- The Linux C truncate function clears the file notes (Programming)

- CentOS 7 version how to achieve the power to start the graphical interface (Linux)

- 11 examples in Linux df command (Linux)

- Oracle 11g maintenance partitions (Seven) - Modifying Real Attributes of Partitions (Database)

 
         
  The wrong in Linux: too many open files
     
  Add Date : 2017-08-31      
         
       
         
  This problem occurs because the number of system files on the program to open the limit.

Use the ulimit -a command to view it

As you can see, the limit on open files is 1024, we can modify the value to increase the number of open files.

************************************************** ****************

Temporary modification:

Change it to 2048, using ulimit -n 2048.

When you open files to increase the value to a certain extent, your Too many open files will not appear again.

************************************************** ****************

To change these two parameter values for a long time, modify /ect/security/limits.conf and add two lines to the file:

* - nofile 65535

* - nproc 65535

NOTE: This line sets the default number of open files per user to 2048. Note The "nofile" entry has two possible restrictions. Is the < type> under the hard and soft. For the maximum number of open files to be changed to take effect, both limits must be set. If you set the < type> with the "-" character, the hard and soft settings are set at the same time.

The hard limit indicates the maximum value that can be set in the soft limit. The soft limit refers to the setting value that the current system takes effect. The hard limit value can be reduced by the normal user. But can not increase. The soft limit can not be set higher than the hard limit. Only the root user can increase the hard limit.

When adding a file limit description, you can simply double the current value. Examples are as follows, if you want to increase the default value of 1024, it is best to increase to 2048, if you want to continue to increase, you need to set to 4096.

Finally, with ulimit-a look at the value of open files, no problem, it has been changed over.

After the above set up to withdraw from the shell re-entry, or not take effect, to the point absolutely

To / etc / profile, add a line ulimit -SHn 51200 (note that there is already a set on the ulimit)

To rc.local, adding a line ulimit -SHn 51200 (I do not know this is not necessary, in fact, I have not added)

Ulimit -S -c 0> / dev / null 2> & 1

This statement sets the software resources and core file size settings

Too many open files to solve the problem

This problem occurs because the number of system files on the program to open the limit.
Use the ulimit -a command to view it
[Root @ 5 ~] # ulimit -a
Core file size (blocks, -c) 0
Data seg size (kbytes, -d) unlimited
Priority (-e) 0
File size (blocks, -f) unlimited
Pending signals (-i) 4096
Max locked memory (kbytes, -l)
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) 10240
Cpu time (seconds, -t) unlimited
Max user processes (-u) 4096
Virtual memory (kbytes, -v) unlimited
File locks (-x) unlimited

As you can see, the limit on open files is 1024, we can modify the value to increase the number of open files.


************************************************** ****************

Temporary modification:

Change it to 2048, using ulimit -n 2048.
When you open files to increase the value to a certain extent, your Too many open files will not appear again.

************************************************** ****************

To change these two parameter values for a long time, modify /ect/security/limits.conf and add two lines to the file:
* - nofile 102400
* - nproc 102400

************************************************** ****************

The ulimit command
1, Description:
Ulimit is used by the shell boot process to take up resources.
2, Category:
Shell built-in command
3, grammar format:
Ulimit [-acdfHlmnpsStvw] [size]
4, the parameter description:
-H Sets hard resource limits.
-S Set soft resource limits.
-a Displays all current resource limits.
-c size: Sets the maximum value of the core file
-d size: Sets the maximum number of data segments in kbytes
-f size: Sets the maximum size of the created file
-l size: Sets the maximum value of the lock process in memory, in kbytes
-m size: Sets the maximum amount of resident memory that can be used in kbytes
-n size: Sets the maximum number of file descriptors the kernel can open at the same time
-p size: Sets the maximum value of the pipe buffer in kbytes
-s size: Sets the maximum stack size in kbytes
-t size: Sets the maximum CPU usage time in seconds
-v size: Sets the maximum value of virtual memory in kbytes
-u < number of programs> The maximum number of programs the user can open
5, a simple example:
1] RH8 environment in the document / etc / profile, we can see how the system is configured ulimit:
#grep ulimit / etc / profile
Ulimit -S -c 0> / dev / null 2> & 1
This statement sets the software resources and core file size settings
2] If we want to make some restrictions on the file size created by the shell, such as:
# Ll h
-rw-r - r-- 1 lee lee 150062 7 22 02:39 h
#ulimit-f 100 # Set the maximum size of the file to be created (one block = 512 bytes)
#cat h> newh
File size limit exceeded
#ll newh
- rw-r - r-- 1 lee lee 51200 November 8 11:47 newh
File h size is 150062 bytes, and we set the creation of the file size is 512 bytes x100 block = 51200 bytes
Of course, the system will be based on your settings generated 51200 bytes of newh file.
3] can be the same as the example 1], you want to set the ulimit / etc / profile on the environment file.
     
         
       
         
  More:      
 
- About Git (Linux)
- Disk Management LVM (Linux)
- Linux System Getting Started Learning: complete installation on Debian or Ubuntu kernel source (Linux)
- Elaborate 10-point difference between the new and malloc (Programming)
- shell script: MySQL startup script simple (Database)
- vnStatSVG: traffic monitoring software vnStat (Linux)
- CentOS system dual network card IP information configuration (Linux)
- Android 5.1 OTA package compilation error (Programming)
- Configuring the remote Linux server SSH key authentication to automatically login in Mac OS X (Server)
- iptables allow only specific ip address to access the specified port (Linux)
- How to Install Telegram instant messaging software on Ubuntu (Linux)
- Java Set and List in the relationship and difference (Programming)
- Linux character device - user mode and kernel mode data transfer data (Linux)
- mysqldump implement database logical backup (Database)
- Dockerfile use to build a mirror-based CentOS 7 (Linux)
- shell script: LVS start simple script (Server)
- Zabbix using Omsa monitor hardware information of Dell server (Server)
- Vi editor Introduction (Linux)
- Ubuntu 12.04 installation instructions under GAMIT10.40 (Linux)
- Merge sort Java implementation (Programming)
     
           
     
  CopyRight 2002-2016 newfreesoft.com, All Rights Reserved.