Art*_*ner 26 postgresql systemd 16.04
刚刚从 14.04 升级了我的系统。LTS 到 16.04.1 LTS,postgresql 不在 systemd 上启动:
/etc/init.d/postgresql start
[ ok ] Starting postgresql (via systemctl): postgresql.service
# /etc/init.d/postgresql status
? postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since ?? 2016-08-09 13:40:51 MSK; 3min 23s ago
Process: 23142 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 23142 (code=exited, status=0/SUCCESS)Seems that
Run Code Online (Sandbox Code Playgroud)
似乎 systemd 脚本包含错误的数据:
# cat /lib/systemd/system/postgresql.service
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.
[Unit]
Description=PostgreSQL RDBMS
[Service]
Type=oneshot
ExecStart=/bin/true
ExecReload=/bin/true
RemainAfterExit=on
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
postgresql 的正确脚本应该是什么?
Art*_*ner 14
Systemd 应该使用来自/etc/init.d. 相反,systemd 使用某种模板文件。要解决这个问题,请按照以下步骤操作:
删除无效的服务脚本:
# rm /lib/systemd/system/postgresql.service
重新加载守护程序脚本:
# systemctl daemon-reload
启用 postgresql 服务:
# systemctl enable postgresql
在这之后,你将能够与任何优选的变化开始的Postgres: sudo systemctl start postgresql,sudo service postgresql start或sudo /etc/init.d/postgresql start。要检查 postgresql 实际运行,请检查服务的状态:sudo systemctl status postgresql。它看起来像:
% sudo systemctl status postgresql
? postgresql.service - LSB: PostgreSQL RDBMS server
Loaded: loaded (/etc/init.d/postgresql; bad; vendor preset: enabled)
Active: active (running) since ?? 2016-08-12 10:13:43 MSK; 1h 37min ago
Docs: man:systemd-sysv-generator(8)
CGroup: /system.slice/postgresql.service
??4086 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
??4099 postgres: checkpointer process
??4100 postgres: writer process
??4101 postgres: wal writer process
??4102 postgres: autovacuum launcher process
??4103 postgres: stats collector process
??? 12 10:13:40 ubuntu-precise systemd[1]: Starting LSB: PostgreSQL RDBMS server...
??? 12 10:13:40 ubuntu-precise postgresql[4009]: * Starting PostgreSQL 9.5 database server
??? 12 10:13:43 ubuntu-precise postgresql[4009]: ...done.
??? 12 10:13:43 ubuntu-precise systemd[1]: Started LSB: PostgreSQL RDBMS server.
Run Code Online (Sandbox Code Playgroud)
mal*_*lte 12
如果您提供正确的版本和集群名称,这应该是开箱即用的。
假设您正在运行版本9.5并且集群被称为main:
开始: systemctl start postgresql@9.5-main
停止: systemctl stop postgresql@9.5-main
地位: systemctl status postgresql@9.5-main
在启动时启用自动启动: systemctl enable postgresql@9.5-main
在启动时禁用自动启动: systemctl disable postgresql@9.5-main
foo@postgres:~$ systemctl status postgresql@9.5-main
? postgresql@9.5-main.service - PostgreSQL Cluster 9.5-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2017-03-31 17:44:46 CEST; 59s ago
Main PID: 4546 (postgres)
CGroup: /system.slice/system-postgresql.slice/postgresql@9.5-main.service
? ? 4546 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
? ? 4548 postgres: checkpointer process
? ? 4549 postgres: writer process
? ? 4550 postgres: wal writer process
? ? 4551 postgres: autovacuum launcher process
? ? 4552 postgres: stats collector process
Mar 31 17:44:44 postgres postgres[4546]: [1-2] 2017-03-31 17:44:44 CEST [4546] @ HINT: Future log output will go to log destination "syslog".
Mar 31 17:44:44 postgres postgres[4547]: [2-1] 2017-03-31 17:44:44 CEST [4547] @ LOG: database system was shut down at 2017-03-31 17:44:43 CEST
Mar 31 17:44:44 postgres postgres[4547]: [3-1] 2017-03-31 17:44:44 CEST [4547] @ LOG: MultiXact member wraparound protections are now enabled
Mar 31 17:44:44 postgres postgres[4546]: [2-1] 2017-03-31 17:44:44 CEST [4546] @ LOG: database system is ready to accept connections
Mar 31 17:44:44 postgres postgres[4551]: [2-1] 2017-03-31 17:44:44 CEST [4551] @ LOG: autovacuum launcher started
Mar 31 17:44:45 postgres postgres[4553]: [3-1] 2017-03-31 17:44:45 CEST [4553] [unknown]@[unknown] LOG: incomplete startup packet
Mar 31 17:44:46 postgres systemd[1]: Started PostgreSQL Cluster 9.5-main.
Mar 31 17:44:47 postgres systemd[1]: Reloading PostgreSQL Cluster 9.5-main.
Mar 31 17:44:47 postgres postgres[4546]: [3-1] 2017-03-31 17:44:47 CEST [4546] @ LOG: received SIGHUP, reloading configuration files
Mar 31 17:44:47 systemd[1]: Reloaded PostgreSQL Cluster 9.5-main.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17594 次 |
| 最近记录: |