ixdba.net,讨论linux+oracle技术

No space left on device: Couldn't create accept lock

上一篇 / 下一篇  2008-01-28 09:54:51 / 个人分类:linux系统管理

查看( 740 ) / 评论( 3 )
   今天下午,一个web集群节点碰到了一个以前没有遇到过的问题,Apache2.0.49无法启动,察看error.log发觉有这样一行错误:
r k?:er;tl0[emerg] (28)No space left on device: Couldn't create accept lock刚开始还以为是空间不足,造成无法创建cgisock文件,但是df -h察看,发觉不是这个问题。求助于google,一下子就找到了原因。
VUa"Pak$~0使用:ipcs -s | grep nobodyIXPUB技术博客3z'eT$ml`@p#p
IXPUB技术博客X%GMv6P

9miI@9xS7E/Z9n;T0察看发觉有一堆ipc使用,需要干掉。这个可能的原因是程序所造成的。IXPUB技术博客&}2xQ*F/O'yJ7z{

&Cn}.Potl l5w0清除命令:IXPUB技术博客2p.m#i{ V]o T
ipcs -s | grep nobody | perl -e 'while (<STDIN>;) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
G"prw'YL0
然后启动Apache即可。
8}$o-d+S2{O4c;@0IXPUB技术博客7FJ#KU3h.T
更深入的了解:IXPUB技术博客m?c)e.e6k]g0a

QX(QN ?tY0

Z%Q$ME1l G0
/c8E_3^W {kl0

Fixing Apache "No space left on device: Couldn't create accept lock" errors

A%UrC J9\0IXPUB技术博客%@;B6O5~"p{

Error Message: When starting Apache, I get this error message in the main Apache error_log:IXPUB技术博客!^$cGi x J


(D By*t2\4|$fbP0

[emerg] (28)No space left on device: Couldn't create accept lock
2?_A L8T0[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
)a\_HF7C,I{0[notice] Digest: generating secret for digest authentication ...
9`2t([G.`+L5r'j0[notice] Digest: done
!DM$k`%G;L0[warn] pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
B5T i9V0|],F0[emerg] (28)No space left on device: Couldn't create accept lock

ys*@\!H;~Wc0
,k/K+Y5y5C~0

First off, check to make sure that you really aren't out of disk space, or have hit a quota limit. Another way that Apache can create the "accept lock" is with a semaphore. A semaphore is an inter-process communication tool that is used by Apache to communicate with it's child processes. This error message may mean that Apache couldn't create a new semaphore.

S,C['JW"p1`0
0cw"iJpu5G0

Check to see how many semaphores are currently in use. If Apache is running correctly, you should see something like this:

2U"b/v%f,A_/oM0g c0
LW\'xep0

# ipcs -sIXPUB技术博客 T&pCn-cM`_
------ Semaphore Arrays --------
{Ze!w'PU!k0key semid owner perms nsemsIXPUB技术博客8zyX_A0ay}%H
0x00000000 68681743 apache 600 1IXPUB技术博客IK.wN4k U(h4A:?
0x00000000 68714515 apache 600 1IXPUB技术博客R$~C5}B$W.hQ
0x00000000 68747291 apache 600 1

5i%y!JF_0IXPUB技术博客Oq1^dU^E,} U&v

If Apache is stopped, and you still see these semaphores, then you can safely kill them by running this command for each semaphore id (in the second column)

|?R-Y4F)J W3h0
1\K:q ^'U0

$ ipcrm -s <semid>

[ _^HloE5K0
DB1J5H&y'Z"p`l/R0

To destroy all semaphores, you can run this from the command line (with "apache" being the apache-user):

A\2vY)xO;uA0
+l0R LFD)HOi)hg3E0

for semid in `ipcs -s | grep nobody | cut -f2 -d" "`;IXPUB技术博客a$tz,?y,u

IXPUB技术博客"zI6q.H!M?

do ipcrm -s $semid; doneIXPUB技术博客G(j"Y-~m


O*E2L#k ^k0


]*{Q3~ ?3x J ]0[
这个地方可能需要改一下,我的apachenobody启的,所以是grep nobodyIXPUB技术博客 wz w4FVT"G

IXPUB技术博客&Un$sl1l,n

IXPUB技术博客$R0{hhEY7s

IXPUB技术博客3Ks8v7o9W m LYk

If you are out of semaphoresIXPUB技术博客 P3Y#Q9U.O#\

IXPUB技术博客bS&l2H{4q

If you can't create any more semaphores:IXPUB技术博客#s7S.q qa.]YM

IXPUB技术博客+O6?v$Js I[

Sometimes your system may need to increase the number of semaphores that are available on the system. This requires a change to a kernel parameter. If you are running on a virtual server and cannot modify kernel parameters, you may need to ask your hosting provider to change this parameter on their host server To view the current parameters:

#}$H n%fTqGMs7M0
~ T#iL8K4fS0

# ipcs -lIXPUB技术博客C*m!DY*O
------ Shared Memory Limits --------
AUj fjR#kU0max number of segments = 4096
2sb[g1s0max seg size (kbytes) = 32768IXPUB技术博客otUYm8Zn9Z
max total shared memory (kbytes) = 8388608IXPUB技术博客C.e dfV8?u _
min seg size (bytes) = 1IXPUB技术博客.En7Y"}}o8L V0]9Lk
IXPUB技术博客:y9h:njT {S
------ Semaphore Limits --------IXPUB技术博客1nZW n!U2z ~S
max number of arrays = 1024
KY)T2jF2@0max semaphores per array = 250
} VV+@7p0max semaphores system wide = 256000IXPUB技术博客,J$eu5p_@2QH9?
max ops per semop call = 32
w@R6R5~8s0semaphore max value = 32767
u9oT4`@&a0IXPUB技术博客:^ K gZiWuy$~4c
------ Messages: Limits --------IXPUB技术博客c5rK r4^0s @a U#Y
max queues system wide = 1024IXPUB技术博客 @b Q"D$Fg-`
max size of message (bytes) = 8192IXPUB技术博客~5a? Y P!}v8H!S$l
default max size of queue (bytes) = 16384

6ZG1i2a'yYY5i-N-x0IXPUB技术博客 [RW.Rb

To change these parameters, modify the file /etc/sysctl.conf and add the following lines:IXPUB技术博客4Ep;e'dS8]]i9?&A


b2NJh#l$_$zr0

kernel.msgmni = 1024
`)D v3j Z1] ?{/W7q0kernel.sem = 250 256000 32 1024
IXPUB技术博客(R&? a1s(H9b*o8\ G


h*lV~'?Xo0

Then load these settings with the command:

}n'm,xF2G"C0
m*n2Pmyu7nn0

这里介绍下kernel.msgmni

3V7R5F+{B;v-S5e\0
0p"k+q6f3C%u$|C0

/proc/sys/kernel/msgmniIXPUB技术博客#xp#nxI"?$l


k1_5Q6lHac0

该文件指定消息队列标识的最大数目,即系统范围内最大多少个消息队列。IXPUB技术博客G NTf$e/f
缺省设置:16IXPUB技术博客fHrXpM;HM&m |


y%jYuxm ^[0


B J$~0u'te0rootIXPUB技术博客Vp#~yq"}|;z G~
下用
8n JB6nh#bH0sysctl kernel.msgmniIXPUB技术博客:k"J,hW)V;PG7M8?|
检查该参数,IXPUB技术博客%l9}4? m9y0m;F*hzs5P
也可以在命令行下IXPUB技术博客s#k)r T.j S geF


\(g?*VF4wI0

sysctl -w kernel.msgmni=XXX
I`kIq1},xnb~O0重新设定。IXPUB技术博客C.f2Z5Z"EU


[e i-K#gX0

sysctl -p

;HA0Y![Y3I0IXPUB技术博客Ei;m:pAr6t2t2F

Your Apache process should now be able to create the needed semaphores and run properlyIXPUB技术博客#b+NgY'c{ y

IXPUB技术博客,n oS-z@2f*P G7d
IXPUB技术博客(`3jcLz3[-` R
IXPUB技术博客!S5GX%X&tW7etl|-K

更多请访问:http://www.ixdba.netIXPUB技术博客sx^2]/Tp f3Y#xb


5ug g$L'Qsx0IXPUB技术博客$yXG6e2q
[本帖最后由 南非蚂蚁 于 2008-1-28 09:52 编辑]

TAG:

下里巴人的家 rickyfang 发布于2008-01-28 09:58:40
######### By RickyFang on 20070312 #####
(k1m9Kj-Zj x;mIXPUB技术社区,交流各种操作系统、服务器、网管技术,网管资源下载,企业网管的天堂,网吧网管的乐园。echo 1 > /proc/sys/net/ipv4/conf/all/rp_filterH(T.IkLK
echo 40960 > /proc/sys/net/ipv4/route/max_size`L`]!|        f
echo 40960 > /proc/sys/net/ipv4/ip_conntrack_tcp_timeout_established=1800eq NF
I;Mr

echo 268435456 > /proc/sys/kernel/shmall
cM,db-`IXPUB技术社区,交流各种操作系统、服务器、网管技术,网管资源下载,企业网管的天堂,网吧网管的乐园。echo 268435456 > /proc/sys/kernel/shmmaxIXPUB技术社区,交流各种操作系统、服务器、网管技术,网管资源下载,企业网管的天堂,网吧网管的乐园。j'eD;Su"y(| U

;G5O~;{,vr2H病毒,木马,下载,服务器,操作系统,数据库,路由器,交换机,防火墙,网络工程,布线,网络编程,游戏,网络基础,硬件,网页制作,网管,网管论坛,网管软件,网管下载,网管技术,网络技术,网管社区,网管博客,企业网管,网吧网管,网吧管理这是偶一直用的,硬件配置是双路双核,4G内存的。病毒,木马,下载,服务器,操作系统,数据库,路由器,交换机,防火墙,网络工程,布线,网络编程,游戏,网络基础,硬件,网页制作,网管,网管论坛,网管软件,网管下载,网管技术,网络技术,网管社区,网管博客,企业网管,网吧网管,网吧管理*i'dZ5Bg_L
病毒,木马,下载,服务器,操作系统,数据库,路由器,交换机,防火墙,网络工程,布线,网络编程,游戏,网络基础,硬件,网页制作,网管,网管论坛,网管软件,网管下载,网管技术,网络技术,网管社区,网管博客,企业网管,网吧网管,网吧管理%zh^)l9k(Z6j
最近在研究KEEPALIVED的集群使用(负载均衡相关)
-`%O g&Mv#L.w:n之前用HA也不错,也久了,有点忘记啦。病毒,木马,下载,服务器,操作系统,数据库,路由器,交换机,防火墙,网络工程,布线,网络编程,游戏,网络基础,硬件,网页制作,网管,网管论坛,网管软件,网管下载,网管技术,网络技术,网管社区,网管博客,企业网管,网吧网管,网吧管理N&]FqY6bGt}K
IXPUB技术社区,交流各种操作系统、服务器、网管技术,网管资源下载,企业网管的天堂,网吧网管的乐园。ikU!N5b&R1I
Q*}q[

不知蚂蚁用的是哪个组合以及什么模式(NAT或是直接路由)?7a-Op]?5I2jd%[D
病毒,木马,下载,服务器,操作系统,数据库,路由器,交换机,防火墙,网络工程,布线,网络编程,游戏,网络基础,硬件,网页制作,网管,网管论坛,网管软件,网管下载,网管技术,网络技术,网管社区,网管博客,企业网管,网吧网管,网吧管理5x]| {E'Xkq+Vds
[ 本帖最后由 rickyfang 于 2008-1-28 10:02 编辑 ]
南非蚂蚁的天空 南非蚂蚁 发布于2008-01-28 10:01:41
配置系统的/proc/sys/kernel,要根据应用而定,不能一概而论!
下里巴人的家 rickyfang 发布于2008-01-28 10:03:35

QUOTE:

原帖由 南非蚂蚁 于 2008-1-28 10:01 发表
Jd^;gQ-R1Jblog.ixpub.net配置系统的/proc/sys/kernel,要根据应用而定,不能一概而论!
;N7}0~+i'b io        JZIXPUB技术博客
(e(Dz[@!o2t;l嗯那,就怕误导大家,所以才把硬件配置也写上的。我就是WEB应用。呵呵
我来说两句

(可选)

Open Toolbar