Server 32G Memory Space
Parameter optimization
$ VI postgresql.conf
Shared_buffers = 3072MB
Max_connections = 4000
Work_mem = 4MB
Effective_cache_size = 4GB
Maintenance_work_mem = 512MB
Wal_buffers = 256
Specific optimization parameter Interpretation reference: 70233820
Error starting Service
$ pg_ctl-d/data/pg_data Start
Server starting
$ log:could Not create IPV6 socket:address family not supported by protocol
Fatal:could not create Semaphores:no space left on device
detail:failed system call is Semget (5432124, 17, 03600).
Hint:this error does *not* mean that you had run out of disk space. It occurs when either the system limit for the maximum number of semaphore sets (Semmni), or the system wide maximum Numbe R of Semaphores (Semmns), would be exceeded. You need to raise the respective kernel parameter. Alternatively, reduce PostgreSQL ' s consumption of semaphores by reducing its max_connections parameter.
The PostgreSQL documentation contains more information on configuring your system for PostgreSQL.
Log:database system is shut down
Analysis:
This is because the configuration of the shared memory in the kernel parameter limits the maximum number of connections, the specific reference blog: https://www.cnblogs.com/xiaotengyi/p/5439231.html
Workaround:
# vi/etc/sysctl.conf
Kernel.sem = 50100 128256000 50100 2560
Overloaded configuration
# sysctl-p
Vm.min_free_kbytes = 409600
Vm.vfs_cache_pressure = 200
vm.swappiness = 0
Fs.file-max = 6815744
FS.AIO-MAX-NR = 1048576
KERNEL.SYSRQ = 1
Kernel.sem = 50100 128256000 50100 2560
Net.core.rmem_default = 2621440
Net.core.wmem_default = 2621440
Net.core.rmem_max = 2621440
Net.core.wmem_max = 2621440
Net.ipv4.tcp_rmem = 4096 655360 2621440
Net.ipv4.tcp_wmem = 4096 655360 2621440
Pgsql error after optimization could not create semaphores:no space