您的位置:首页 > 运维架构 > Apache

apache 无法启动故障排查

2008-06-13 17:21 309 查看
今天在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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息