systemd deletes shared memory segment in postgresql

最近在server上部署PostgreSQL9.5(源碼安裝), 老是報because another server process exited abnormally and possibly corrupted shared memory, google 發現居然是systemd問題。sql

在RHEL7.2中,systemd-logind 服務引入了一個新特性,該新特性是:當一個user徹底退出os以後,remove掉這個user全部的IPC objects。
該特性由/etc/systemd/logind.conf參數文件中RemoveIPC選項來控制。詳細請看man logind.conf(5)
在RHEL7.2中,RemoveIPC的默認值爲yespost

cat /etc/systemd/logind.confgoogle

> [Login]

#NAutoVTs=6

#ReserveVT=6

#KillUserProcesses=no

#KillOnlyUsers=

#KillExcludeUsers=root

#InhibitDelayMaxSec=5

#HandlePowerKey=poweroff

#HandleSuspendKey=suspend

#HandleHibernateKey=hibernate

#HandleLidSwitch=suspend

#HandleLidSwitchDocked=ignore

#PowerKeyIgnoreInhibited=no

#SuspendKeyIgnoreInhibited=no

#HibernateKeyIgnoreInhibited=no

#LidSwitchIgnoreInhibited=yes

#IdleAction=ignore

#IdleActionSec=30min

#RuntimeDirectorySize=10%   

#RemoveIPC=yes

so 能夠經過hibernate

  1. set RemoveIPC=no in /etc/systemd/logind.confrest

  2. systemctl daemon-reloadpostgresql

  3. systemctl restart systemd-logindcode

Referencesorm

相關文章
相關標籤/搜索