服務(wù)器32G內(nèi)存空間
鎮(zhèn)海ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
參數(shù)優(yōu)化
$ vi postgresql.conf
shared_buffers = 3072MB
max_connections = 4000
work_mem = 4MB
effective_cache_size = 4GB
maintenance_work_mem = 512MB
wal_buffers = 256
具體優(yōu)化參數(shù)解釋參考:https://blog.csdn.net/zhousenshan/article/details/70233820
啟動服務(wù)出錯
$ 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 was semget(5432124, 17, 03600).
HINT: This error does *not* mean that you have 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 number 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 about configuring your system for PostgreSQL.
LOG: database system is shut down
分析:
這是因?yàn)閮?nèi)核參數(shù)中共享內(nèi)存的配置限制了最大連接數(shù),具體參考博客:https://www.cnblogs.com/xiaotengyi/p/5439231.html
解決辦法:
# vi /etc/sysctl.conf
kernel.sem = 50100 128256000 50100 2560
重載配置
# 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