apache startup reports shmget of failed: solution for Invalid argument

  • 2020-05-06 12:10:37
  • OfStack

On the apache server in use, start error:


shmget() failed:  Invalid argument
Failed to start up concurrent users module!

Es10en.shmmax Settings are not valid (copy for another system, the value setting is too high)

As follows:


[root@localhost ~]# sysctl -a | grep shmm
kernel.shmmni = 4096
kernel.shmmax = 0
[root@localhost ~]# vi /etc/sysctl.conf
kernel.shmmax = 2147483648
kernel.shmall = 1073742
[root@localhost ~]# sysctl -p
[root@localhost ~]# sysctl -a | grep shm        
vm.hugetlb_shm_group = 0
kernel.shmmni = 4096
kernel.shmall = 1073742
kernel.shmmax = 2147483648


kernel.shmmax numerical description:
Unit: bytes. It is generally recommended to use half of
of physical memory Take 4G memory as an example: 4096/2*1024*1024=2147483648

kernel.shmall numerical description:
Unit: page. 1 page =4k, set the value to physical memory size
Take 4G memory as an example: 4096*1024*1024/4000=1073742

Note: the above two values will not be valid if they are larger than the physical memory.

I hope the above solutions can solve your problems.


Related articles: