本文主要是介绍PostgreSQL Systemctl启动设置,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
root用户
cd /usr/lib/systemd/system
vi postgresql.service #增加下面内容,并根据实际内容修改
[Unit]
Description=PostgreSQL database server
After=network.target
[Service]
Type=forking
User=postgres
Group=postgres
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0
Environment=PGSTARTTIMEOUT=300
Environment=PGDATA=/opt/pg12.4/data
ExecStart=/opt/pg12.4/bin/pg_ctl start -D ${PGDATA} -l /home/postgres/logfile -s -w -t ${PGSTARTTIMEOUT}
ExecStop=/opt/pg12.4/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/opt/pg12.4/bin/pg_ctl reload -D ${PGDATA} -s
[Install]
WantedBy=multi-user.target
在建立文件后,postgresql.serivce需要将文件加载进systemctl并且在打开enable
systemctl daemon-reload
systemctl enable postgresql
systemctl start postgresql
systemctl list-units --type=service --state=active
systemctl list-units --type=service --state=running
这篇关于PostgreSQL Systemctl启动设置的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!