一、目的
在安装OceanBase时脚本报错
[ERROR] OBD-1007: (127.0.0.1) The value of the ulimit parameter "open files" must not be less than 20000 (Current value: 1024), Please execute `echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf` as root in 127.0.0.1. if it dosen't work, please check whether UsePAM is yes in /etc/ssh/sshd_config.
[ERROR] OBD-1007: (127.0.0.1) The value of the ulimit parameter "max user processes" must not be less than 120000 (Current value: 4096), Please execute `echo -e "* soft nproc 120000\n* hard nproc 120000" >> /etc/security/limits.d/nproc.conf` as root in 127.0.0.1. if it dosen't work, please check whether UsePAM is yes in /etc/ssh/sshd_config.
二、解决方法(root用户下)
1 增加打开文件的最大数量
[root@hurys22 ~]# echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf
2 增加用户进程的最大数量
[root@hurys22 ~]# echo -e "* soft nproc 120000\n* hard nproc 120000" >> /etc/security/limits.d/nproc.conf
3 重启 SSH 服务
[root@hurys22 ~]# systemctl restart sshd
4查看文件夹/etc/ssh/sshd_config的UsePAMUsePAM
设置没有被注释掉,并且设置为 yes
5 登录到一个新的 SSH 会话进行验证
[root@hurys22 ~]# ulimit -n
20000
[root@hurys22 ~]# ulimit -u
120000
搞定!