Introduction
You may have seen an error similar to the following, preventing PostgreSQL or another service from running properly:
2020-08-01 15:55:53 EDTFATAL: could not create shared memory segment: Invalid argument
2020-08-01 15:55:53 EDTDETAIL: Failed system call was shmget(key=5432002, size=146268160, 03600).
2020-08-01 15:55:53 EDTHINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 146268160 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
This guide will show you how to raise the SHMMAX limit in CentOS/CloudLinux 7.
Procedure
Log in to SSH as the root user or open the WHM Terminal as the root user and run the following command:
cat /proc/sys/kernel/shmmax
The output of the above command will be a number representing the current limit. You will need to modify this configuration file using your preferred editor via SSH or the WHM Terminal as the root user:
/etc/sysctl.conf
If this section doesn't already exist, you can create it:
kernel.shmmax=#########
The new limit should replace the #########.
After updating the limit in the file, you can reload the configuration with this command:
sysctl -p
To determine the best or safest limitation for the server, we would advise consulting with a systems administrator. You can find system administrative services here.
However, please note that cPanel, LLC does not endorse or recommend any particular provider on that list, nor can we be held liable for any services performed by third-party providers, including those on the list.
Comments
0 comments
Article is closed for comments.