httpd dead but pid file existsApache起不来,报No space left on device: Couldn’t create accept lock
一大堆的ipc使用,需要干掉。 查看the number of semaphores that are available on the system admin@intlqa142012x:[/home/admin]ipcs -l
—— Shared Memory Limits ——–
—— Semaphore Limits ——–
—— Messages: Limits ——–
如果有权限的话,可以修改这些限制:
kernel.msgmni = 1024
Then load these settings with the command:sysctl -p
admin@intlqa142012x:[/home/admin]sysctl -p Your Apache process should now be able to create the needed semaphores and run properly.
说明:kernel.msgmni
admin@intlqa142012x:[/home/admin]cat /proc/sys/kernel/msgmni 在root下可用sysctl kernel.msgmni检查该参数:
admin@intlqa142012x:[/home/admin]sysctl kernel.msgmni 也可以在命令行下,使用sysctl -w kernel.msgmni=XXX重新设定。
admin@intlqa142012x:[/home/admin]sysctl -w kernel.msgmni=32
ipcs 命令
ipcs – 分析消息队列、共享内存和信号量 ipcs displays certain information about active interprocess communication facilities. With no options, ipcs displays information in short format for the message queues, shared memory segments, and semaphores that are currently active in the system.
引用
它的语法:
ipcs [-mqs] [-abcopt] [-C core] [-N namelist]
ipcrm – 删除ipc(清除共享内存信息)
引用
它的语法:
ipcrm -m|-q|-s shm_id -m 输出有关共享内存(shared memory)的信息 -q 输出有关信息队列(message queue)的信息 -s 输出信号量(semaphore)的信息 shm_id 共享内存id #ipcrm -m 501
其打印出当前你的系统中处于活动状态的共享内存的信息。 对每一个资源,这个命令会显示: TYPE 包括信息队列(q),共享内存段(m),或者信号灯(s)。 ID 资源条目的唯一的表示号 KEY 应用程序存取资源使用的参数。 MODE 存取模式和许可权限的标记 OWNER and GROUP 登录名和用户属主的组号,OnLine使用的所有的共享内存资源的属主的属主 为root和informix组。
OnLine共享内存使用的基本键值为0x52564801。SERVERNUM的值乘上0X10000并且加上这个值就为共享内存的键值。这就 是,如果你的SERVERNUM的值为2,你的共享内存段的键值为0x52564801+(2*0x10000)=0x52584801。如果 SERVERNUM的值为6,产生的键值就为0x525c4801。
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 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 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 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
—— Semaphore Limits ——–
—— Messages: Limits ——– To change these parameters, modify the file /etc/sysctl.conf and add the following lines:
kernel.msgmni = 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
该文件指定消息队列标识的最大数目,即系统范围内最大多少个消息队列。 在 root 下用 sysctl kernel.msgmni 检查该参数, 也可以在命令行下 sysctl -w kernel.msgmni=XXX 重新设定。
man ipcs: ipcs(1) ipcs(1)
NAME
SYNOPSIS
DESCRIPTION
Options (none) This is equivalent to -mqs.
-m Display information about active shared memory -s Display information about active semaphores.
The following options add columns of data to the display. See “Column
(none) Display default columns: for all facilities: T,
-a Display all columns, as appropriate. This is
-b Display largest-allowable-size information: for
-c Display creator’s login name and group name: for
-o Display information on outstanding usage: for
-p Display process number information: for message
-t Display time information: for all facilities: Hewlett-Packard Company – 1 – HP-UX Release 11i: November 2000 ipcs(1) ipcs(1)
shared memory segments: ATIME, DTIME; for The following options redefine the sources of information.
-C core Use core in place of /dev/kmem. core can be a
-N namelist Use file namelist or the namelist within core in
Column Descriptions T Facility type:
m Shared memory segment ID The identifier for the facility entry.
KEY The key used as an argument to msgget(), semget(), or The first two characters can be:
R A process is waiting on a msgrcv().
The next 9 characters are interpreted as three sets of
Hewlett-Packard Company – 2 – HP-UX Release 11i: November 2000 others.
Within each set, the first character indicates
r Read permission is granted. OWNER The login name of the owner of the facility entry.
GROUP The group name of the group of the owner of the CREATOR The login name of the creator of the facility entry.
CGROUP The group name of the group of the creator of the
CBYTES The number of bytes in messages currently outstanding
QNUM The number of messages currently outstanding on the
QBYTES The maximum number of bytes allowed in messages
LSPID The process ID of the last process to send a message to
LRPID The process ID of the last process to receive a message
STIME The time the last msgsnd() message was sent to the
RTIME The time the last msgrcv() message was received from
CTIME The time when the associated facility entry was created
NATTCH The number of processes attached to the associated SEGSZ The size of the associated shared memory segment. Hewlett-Packard Company – 3 – HP-UX Release 11i: November 2000 ipcs(1) ipcs(1)
CPID The process ID of the creating process of the shared
LPID The process ID of the last process to attach or detach
ATIME The time the last shmat() attach was completed to the
DTIME The time the last shmdt() detach was completed on the
NSEMS The number of semaphores in the set associated with the
OTIME The time the last semop() semaphore operation was
WARNINGS
Do not rely on the exact field widths and spacing of the output, as
FILES
STANDARDS CONFORMANCE Hewlett-Packard Company – 4 – HP-UX Release 11i: November 2000 |