ssh Linux系统时报错:Write failed: Broken pipe,Resource temporarily unavailable |
发表者:admin分类:Devops2017-01-11 10:36:19 阅读[2572] |
应该是超出了系统当前设置的值。
关于超出资源限制的事之前有碰到过,只不过不是这个错误,
而是open files: cannot modify limit: Operation not permitted。
下面描述一下关于Resource temporarily unavailable这个错误及其相关信息。
ssh 命令使用普通用户连接服务器,然后就出现错误提示:
Write failed: Broken pipe
在root用户下切换普通用户报错:
[root@snaqi-test3 bin]# su - oracle
su: cannot set user id: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: retry: Resource temporarily unavailable
bash: fork: Resource temporarily unavailable
执行以下命令查看
ps -U oracle | wc -l lsof | grep oracle | wc -l
用户打开文件资源数。
这里就参照安装oracle时的配置参数修改下相对应的用户配置。
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
修改系统内核参数:
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1987162112
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
编辑/etc/security/limits.conf
vi /etc/security/limits.conf
oracle soft nproc 131072
oracle hard nproc 131072
oracle soft nofile 131072
oracle hard nofile 131072
oracle soft core unlimited
oracle hard core unlimited
oracle soft memlock 50000000
oracle hard memlock 50000000
使用ulimit命令来修改
--在使用ulimit命令方式来修改的话,当服务器被重启后会失效(临时性更改)
--ulimit 用于限制 shell 启动进程所占用的资源
--支持以下各种类型的限制:所创建的内核文件的大小、进程数据块的大小、Shell进程创建文件的大小、内存锁住的大小、常驻内存集的大小
--以及打开文件描述符的数量、分配堆栈的最大大小、CPU 时间、单个用户的最大线程数、Shell 进程所能使用的最大虚拟内存
--以及支持硬资源和软资源的限制
oracle@v2013db02u:~> ulimit -n 60000 -->使用当前用户来修改,即oracle用户,我们将其改为60000
oracle@v2013db02u:~> ulimit -a | grep "open files" -->可以看到该资源限制已经被修改
open files (-n) 60000
oracle@v2013db02u:~> cat /etc/security/limits.conf | grep nofile -->但配值文件并未发生任何变化
oracle soft nofile 1024
oracle hard nofile 65536
oracle@v2013db02u:~> ulimit -n 65537 -->尝试修改到大于65536,收到错误提示
-bash: ulimit: open files: cannot modify limit: Operation not permitted
oracle@v2013db02u:~> ulimit -n 65535 -->使用ulimit命令时,number的值不能大于配值文件中hard的值
oracle@v2013db02u:~> ulimit -a | grep "open files"
open files (-n) 65535
--其余参数都可以按上述方式依法炮制
转载请标明出处【ssh Linux系统时报错:Write failed: Broken pipe,Resource temporarily unavailable】。
《www.micoder.cc》
虚拟化云计算,系统运维,安全技术服务.
Tags: | [阅读全文...] |
最新评论