Galaxy Kirin server system changes the default value of open file

Galaxy Kirin server system changes the default value of open file

An open file value description

Open File Limit is the maximum number of files that a user or process can open in the current session in the Linux system. Exceeding the limit may cause program accidents, such as errors or crashes.

​Soft Limit: The upper limit of the number of open files that can be changed by any user or process. The modification only takes effect for the current user (or process), that is, it takes effect temporarily and will not take effect if you log in again or restart the process.

Hard Limit: The upper limit of the changeable value of Soft Limit, which can only be modified by the root user;

2. View the open file value command of the current system

查看soft limit
ulimit -Sn
查看hard limit
ulimit -Hn

3. Temporary modification (only effective for the current session)

修改soft limit
ulimit -Sn 65535
修改Hard limit
ulimit -Hn 65535

Four permanent modifications

1. Edit the limits.conf file

vim /etc/security/limits.conf

2. Add 2 lines: * means it is effective for all users

* hard nofile 65535
* soft nofile 65535

3. If it is only specified to take effect for a certain ordinary user, change * to the name of an ordinary user, such as test user.

test hard nofile 65535
test soft nofile 65535

4. Reload the configuration to make it effective. Two methods

方法一 重新登录系统:修改limits.conf文件后,退出当前用户,重新登录系统即可生效。
方法二 重启系统,会加载limits.conf配置文件。

Guess you like

Origin blog.csdn.net/weixin_45754407/article/details/132752629