ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【ERROR】Linux su用户报 su: /bin/bash: Too many open files in system

【ERROR】Linux su用户报 su: /bin/bash: Too many open files in system

原创 Linux操作系统 作者:yhdmy 时间:2016-02-25 12:35:04 0 删除 编辑
一、问题描述
     今天准备对weblogic主机进行操作更新时发现,无法使用su - weblogic命令了,报错:【su: /bin/bash: Too many open files in system】,这是什么原因导致的,通过字面意思,我理解是在操作系统打开太多的文件,于是我感觉应该是系统级参数,上网找了些文件,发现linux是个有file-max限制,下面我就将这个案例回放一下。

二、故障处理
1.登录weblogic用户失败,报错
[root@hcrapp2 ~]# su - weblogic
su: /bin/bash: Too many open files in system

2.检查file-max参数值
[root@hcrapp2 ~]#  cat /proc/sys/fs/file-max
4096

3.修改加大系统级别的file-max值
[root@hcrapp2 ~]# vi /etc/sysctl.conf
# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

fs.file-max = 4096  替换为  6553600
"/etc/sysctl.conf" 42L, 1173C written

4.使修改的file-max值生效
[root@hcrapp2 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 6553600

5.检查修改后是否成功生效
[root@hcrapp2 ~]# cat /proc/sys/fs/file-max
6553600

6.登录weblogic用户成功
[root@hcrapp2 ~]# su - weblogic
[weblogic@hcrapp2 ~]$


三、总结
     这个系统参数的修改,是很容易被忽略掉的,因为系统安装人员,未必就是使用运维人员,所以这也就对SA的运维经验是个衡量,不管是SA,DBA都应该有自己的文档、脚本库,以便提早的发现参数的限制不合理,像这样的参数应该在上线前就排除掉。当然出现问题也不是什么可怕的事情,哪有一生下来就什么都会的,慢慢的经验就丰富起来了。加油吧,向新的高度前进。
It’s never too late to be what you might have been.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26148431/viewspace-1994334/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
曾就职于铁道科学研究院,太极计算机公司,合力中税。负责过国家电网数据库部署、迁移、升级、灾备等实施规划工作。大唐发电厂、北京市公安局数据库运维及优化工作。现任工场高级DBA岗位,负责oracle、mysql数据库相关工作。拥有Oracle技术10g/11g的 OCP与OCM认证,Oracle YEP成员,OCM联盟成员。

注册时间:2013-04-22

  • 博文量
    107
  • 访问量
    1609786