li
  当前位置:主页 > 基础知识 > 文章内容
li
apache无法起动:No space left on device: Couldn't create accept lock
来源: www.ixdba.net  作者: IXDBA.NET官方    时间:2008-01-23   阅读:13  

今天下午,一个web集群节点碰到了一个以前没有遇到过的问题,Apache2.0.54无法启动,察看error.log发觉有这样一行错误:
[emerg] (28)No space left on device: Couldn't create accept lock
   
刚开始还以为是空间不足,造成无法创建cgisock文件,但是df -h察看,发觉不是这个问题。求助于google,真是好帮手,一下子就找到了原因。
使用: ipcs -s | grep nobody 察看发觉有一堆ipc使用,需要干掉。这个可能的原因是程序所造成的。
IXDBA.NET技术社区
清除命令:
ipcs -s | grep nobody | perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
然后启动Apache即可。

更深入的了解:

 

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

Error Message: When starting Apache, I get this error message in the main Apache error_log:

[emerg] (28)No space left on device: Couldn't create accept lock
[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[warn] pid file /etc/httpd/run/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[emerg] (28)No space left on device: Couldn't create accept lock

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.

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

# ipcs -s
------ Semaphore Arrays --------
key semid owner perms nsems
0x00000000 68681743 apache 600 1
0x00000000 68714515 apache 600 1
0x00000000 68747291 apache 600 1

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)

$ ipcrm -s <semid>

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

for semid in `ipcs -s | grep nobody | cut -f2 -d" "`;

do ipcrm -s $semid; done


[
这个地方可能需要改一下, 我的apachenobody启的,所以是grep nobody

 

If you are out of semaphores

If you can't create any more semaphores:

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:

# ipcs -l
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 32768
max total shared memory (kbytes) = 8388608
min seg size (bytes) = 1

------ Semaphore Limits --------
max number of arrays = 1024
max semaphores per array = 250
max semaphores system wide = 256000
max ops per semop call = 32
semaphore max value = 32767

------ Messages: Limits --------
max queues system wide = 1024
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384

To change these parameters, modify the file /etc/sysctl.conf and add the following lines:

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

Then load these settings with the command:

sysctl -p

Your Apache process should now be able to create the needed semaphores and run properly

这里介绍下kernel.msgmni

/proc/sys/kernel/msgmni

该文件指定消息队列标识的最大数目,即系统范围内最大多少个消息队列。
缺省设置:16

root 下用 sysctl kernel.msgmni 检查该参数, 也可以在命令行下

sysctl -w kernel.msgmni=XXX 重新设定。




  上一篇: apche+php+mysql集与一体的工具...   下一篇: Apache 重写规则的常见应用 (rew...
li
 §相关评论  
 热点文章

·RewriteRule重写规则的语法:A
·apache配置文件httpd.conf参数
·Apache的配置文件http.conf参数
·HTTP协议中POST、GET、HEAD等参
·XAMPP命令之LAMPP
·Linux中安装XAMPP(LAMPP)服务器
·网页禁止右键、禁止复制等代码
·java.lang.OutOfMemoryError:
·Mysql数据库在Linux系统常用命
·mysql问答:MySQL数据库连接过多
·MySQL数据库中Show命令的用法
li
 编辑推荐
·RewriteRule重写规则的语法:A
·apache配置文件httpd.conf参数
·Apache的配置文件http.conf参数
·HTTP协议中POST、GET、HEAD等参
·XAMPP命令之LAMPP
·Linux中安装XAMPP(LAMPP)服务器
·网页禁止右键、禁止复制等代码
·java.lang.OutOfMemoryError:
·Mysql数据库在Linux系统常用命
·mysql问答:MySQL数据库连接过多
·MySQL数据库中Show命令的用法
li
 相关篇章
·apche+php+mysql集与一体的工具...
·IBM服务器Broadcom NetXtreme II...
·MySQL入门教程
·MySQL常用操作小结
·MySQL修改密码方法总结
·JDBC 连接各种数据库方法总结
·MySQL数据库备份与恢复
·linux下tar解包报时间戳问题
·Linux操作系统下两种自动启动Tom...
·我为什么选择了unix/linux:UNIX操...
·Apache 重写规则的常见应用 (rew...
·Apache URL Rewrite常用配置两种...
·mysql中root用户失去了root权限怎...
·卡巴斯基KEY_能用到2010年
·Apache HTTP Server与Tomcat的三...
·快速修复mysql数据库
·MySQL数据库安全配置
·Mysql中mysqldump命令使用详解 (...
·Mysql中mysqldump命令使用详解 (...
·[MySQL]服务器的启动与停止 (1)
 
li
设为首页 | 关于我们 | 技术服务 | 收藏本站 | 网站地图 | 联系方式 | 本站友情连接