博客统计信息

51cto博客之星
用户名:coolerfeng
文章数:243
评论数:548
访问量:445563
无忧币:4944
博客积分:3133
博客等级:7
注册日期:2007-03-21

apache 无法启动故障排查
2008-06-13 17:21:25
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://coolerfeng.blog.51cto.com/133059/81814
今天在F5上逛,发现某个ip下面的机器的80和443端口down了。
于是手动重启,结果发现apachectl start,可以正常启动,apachectl startssl却不行
查看log
[Wed Apr 16 08:54:52 2008] [warn] pid file /usr/local/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jun 13 11:59:24 2008] [alert] httpd: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
semget: 设备上没有空间

网上查了半天也无解。试图删除/usr/local/apache/logs/httpd.pid再重启也不行。
问同事才知道
使用ipcs查看系统的信号量,发现是信号量sem已经满了,所以导致startssl无法启动。
据说是如果apache没有正常Stop掉的话,它的信号量是不会自动清除的,导致其一直滞留在内存中
于是,用以下命令清除sem信号量后,apache就可以正常启动了:
for i in `ipcs  | grep nobody | awk '{print $2}'`; do ipcrm -s $i; done

看来,以后我们需要慎用killall -9 httpd,尽量使apache能正常的stop

[root@l_192_168_131_164 log]# ipcs
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 7143424    root      600        184324     74         dest          
------ Semaphore Arrays --------
key        semid      owner      perms      nsems      
0x00000000 0          nobody    600        1          
0x00000000 32769      nobody    600        1          
0x00000000 65538      nobody    600        1          
。。。。。。。。。
。。。。。。。。。
0x00000000 98307      nobody    600        1          
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages  
可以看到很多
清除了就可以了
for i in `ipcs  | grep nobody | awk '{print $2}'`; do ipcrm -s $i; done
然后再查看
[root@l_192_168_132_089 /root]# ipcs
------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status      
0x00000000 8552448    root      600        184324     74         dest          
------ Semaphore Arrays --------
key        semid      owner      perms      nsems      
0x00000000 8486912    nobody    600        1          
------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages  
没有那么多了。
再重新启动apache,这次正常启动了
另外一个问题,就是日志是用中文输出的,对应的错误提示在网上无法搜到,而对应的英文
semget: 设备上没有空间
semget: No space left on device
在google上很容易找到结果。看来以后要把服务器的默认语言设置为英文才行。
 
#export LC_ALL=en_US
#locale
 

本文出自 “风吹云动” 博客,请务必保留此出处http://coolerfeng.blog.51cto.com/133059/81814

0人
了这篇文章
类别:linux技术圈()┆阅读()┆评论() ┆ 推送到技术圈返回首页

文章评论

 
2008-06-13 17:32:38
顶一下,写得真好,我什么时候才能达到这水平啊。。。

2008-06-13 18:06:39
阅览广告作品

2008-06-14 12:10:18
高人 顶啊顶

2008-06-14 12:27:34
技术内容完全看不懂,不过大概意思明白了!
就像停车似的,要正规慢慢停车才行,强行突然停车会有隐患的!
嗯,估计就是这意思!

2008-06-16 13:09:13
有前途的年轻人

 

发表评论            

[社区周刊] 职业发展,选择大都市还是回老家?
昵  称:
登录  快速注册
验证码:

请点击后输入验证码博客过2级,无需填写验证码

内  容: