Postgresql - 不存在 PostgreSQL 集群;在服务重启期间查看“man pg_createcluster”

2023-11-23

我试图停止已在 Ubuntu 服务器上运行的 Postgresql 9.3 数据库,但收到以下消息:

root@myprodserver:~# sudo /etc/init.d/postgresql stop

 * No PostgreSQL clusters exist; see "man pg_createcluster"

如果我尝试列出集群,我会得到一个空结果:

root@myprodserver:~# pg_lsclusters
Ver Cluster Port Status Owner Data directory Log file

我尝试运行 createcluster :

root@myprodserver:~# pg_createcluster 9.3 main

Configuring already existing cluster (configuration: /etc/postgresql/9.3/main, data: /var/lib/postgresql/9.3/main, owner: 106:114)
Error: move_conffile: required configuration file /var/lib/postgresql/9.3/main/postgresql.conf does not exist

The database is up and running. The response shows that a cluster exists. I've restarted many times the service in the past without error messages.

下面是结果sudo ps aux | grep postgres :

root       673  0.0  0.0  11748  2232 pts/5    R+   15:57   0:00 grep --color=auto postgres

postgres  1044  0.0  0.2 293560 17868 ?        S     2017  87:45 /usr/lib/postgresql/9.3/bin/postgres -D /var/lib/postgresql/9.3/main -c config_file=/etc/postgresql/9.3/main/postgresql.conf
postgres  1288  0.2  1.7 294156 142248 ?       Ss    2017 657:18 postgres: checkpointer process
postgres  1289  0.2  1.7 293700 140836 ?       Ss    2017 694:24 postgres: writer process
postgres  1290  0.0  0.0 293560  7476 ?        Ss    2017 140:10 postgres: wal writer process
postgres  1291  0.0  1.3 294508 107148 ?       Ss    2017  55:46 postgres: autovacuum launcher process
postgres  1292  0.0  0.0 105220  3772 ?        Ss    2017 172:17 postgres: stats collector process
postgres  7669  0.0  0.2 296244 17700 ?        Ss   12:04   0:02 postgres: adempiere postgres ::1(49525) idle
postgres  7671  0.0  0.6 298716 54004 ?        Ss   12:04   0:00 postgres: adempiere adempiere_produzione ::1(49526) idle
postgres  7855  0.0  0.4 295844 38160 ?        Ss   12:04   0:00 postgres: adempiere adempiere_produzione ::1(49527) idle
postgres  8068  0.0  0.2 294884 18324 ?        Ss   12:06   0:00 postgres: adempiere adempiere_produzione ::1(49528) idle
postgres 10115  0.0  1.9 308236 159916 ?       Ss   14:25   0:05 postgres: adempiere adempiere_produzione 192.107.YY.XXX(55631) idle
(continues)

服务器关闭后PG无法启动,集群(数据库实例)丢失。

最后我已经能够恢复它了。我必须纠正一些东西(见下文)然后我执行了:

sudo pg_createcluster 9.3 main

那么你应该开始它

sudo /etc/init.d/postgresql start

系统回复道: 配置已经存在的集群....

在这些情况下要做的事情: - 检查所有配置文件和数据文件是否位于正确的文件夹中 - 检查文件 postmaster.opts 是否指向正确的位置

如果主集群(通常是“main”)仍未启动,您可以使用以下命令创建一个新集群:

pg_createcluster 9.3 cluster2

然后将数据库备份恢复到新集群。

控制PG集群的命令:

列出集群

pg_lsclusters 

启动/停止集群

pg_ctlcluster <pg version> <cluster name> <start|stop>
pg_ctlcluster 9.3 main start 
pg_ctlcluster 9.3 clust2 stop 

停止集群 - 删除活动连接

pg_ctlcluster -m fast 9.3 clust2 stop 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Postgresql - 不存在 PostgreSQL 集群;在服务重启期间查看“man pg_createcluster” 的相关文章

随机推荐