service 啟動方式
# For example, if you want to change the server's port number to 5433,
# create a file named "/etc/systemd/system/postgresql.service" containing:
# .include /lib/systemd/system/postgresql.service
# [Service]
# Environment=PGPORT=5433
# This will override the setting appearing below.
sudo vim /etc/systemd/system/postgresql.service
按照這個官方說明改好以後, 發現....
根本沒有作用.還是用 5432 啟動的
直接修改吧.蛋疼
sudo vim /lib/systemd/system/postgresql.service
然後重新載入
sudo systemctl daemon-reload
於是....
啟動不起來了
postgresql.service - PostgreSQL database server
Loaded: loaded (/etc/systemd/system/postgresql.service; enabled)
Active: failed (Result: exit-code) since 二 2015-03-03 19:06:19 CST; 9s ago
Process: 8305 ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast (code=exited, status=0/SUCCESS)
Process: 8359 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
Process: 8353 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Main PID: 32289 (code=exited, status=0/SUCCESS)
這不是蛋疼,這是蛋碎了
改回去,還是啟動不能.估計增加了/etc下的檔案後, 還要再執行一次 reload
好吧.那我把/etc...的檔案連接埠改回去
於是可以啟動了..尼瑪!!
不玩了,我用原始方式啟動吧
pg_ctl -D /var/lib/pgsql/data -p 5433 -l logfile start