繁体   English   中英

重新启动后在Postgres中丢失数据库

[英]Lost databases in Postgres after restart

首先,我是Postgres SQL的新手。 我已在具有两个卷,一个根卷和另一个数据卷的EC2实例中安装了Postgres。

我有4个正常工作的数据库,当我停止并启动实例时,无法连接到那些数据库。

这些是重新启动计算机后运行的进程。

ps aux | grep post
postgres  2569  0.0  1.3 230400 13484 ?        S    07:24   0:00 /usr/lib64/pgsql92/bin/postmaster -p 5432 -D /var/lib/pgsql9/data
postgres  2571  0.0  0.3 190148  3748 ?        Ss   07:24   0:00 postgres: logger process                                         
postgres  2573  0.0  0.3 230400  3944 ?        Ss   07:24   0:00 postgres: checkpointer process                                   
postgres  2574  0.0  0.4 230400  5048 ?        Ss   07:24   0:00 postgres: writer process                                         
postgres  2575  0.0  0.3 230400  3944 ?        Ss   07:24   0:00 postgres: wal writer process                                     
postgres  2576  0.0  0.6 231220  6388 ?        Ss   07:24   0:00 postgres: autovacuum launcher process                            
postgres  2577  0.0  0.4 190144  4616 ?        Ss   07:24   0:00 postgres: stats collector process                                
root      2812  0.0  0.4 192244  4084 pts/0    S    07:25   0:00 su postgres
postgres  2813  0.0  0.3 113444  3256 pts/0    S    07:25   0:00 bash
postgres  2941  0.0  0.1 115276  1988 pts/0    R+   08:15   0:00 ps aux
postgres  2942  0.0  0.1 110440  1812 pts/0    S+   08:15   0:00 grep pos

谁能帮我。

如果postgres已启动并正在运行,而您没有看到所拥有的数据库,则很可能是在同一端口上运行了不同的集群,因此实际上是使用相同的连接字符串连接到了不同的集群。 如果是这样,请关闭正在运行的群集并启动正确的群集。 您可能还想将sysconfig编辑为正确的(不是默认值) data_directory 或使用pg_createcluster注册新集群,或仅使用带有pg_ctl -D your_data_directory start手动启动pg_ctl -D your_data_directory start ...

首先,您应该更改主题的名称,因为它与还原数据库无关,而是与数据库重新启动或重新连接。

然后,您应该使用psql(以用户postgres连接)尝试进行连接:

psql mydb

它可能不起作用,但至少您会获得有关您的问题的更多信息(并能够让他们使用)。

最后,如果数据库是通过Amazon Web界面创建的,则应检查Web界面上它们的状态(正在工作,已暂停)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM