【问题标题】:Can't connect to database from snapshot. Ubuntu 18.04 postgres 9.5无法从快照连接到数据库。 Ubuntu 18.04 postgres 9.5
【发布时间】:2020-04-08 23:26:59
【问题描述】:

我正在尝试连接到从磁盘快照恢复的数据库。我有 ubuntu 18.04 的新虚拟机。我从 *.deb 文件安装了 postgres、postgres-client 和 postgres-contrib。然后我将托管磁盘安装到带有数据库的机器中并尝试连接 - 没有成功。

Postgres 服务器运行良好,集群正常,状态正常,pg_isready 正常。 直到我将postgresql.conf 中的data_directory 从默认更改为已安装-/snapshot_data_path/。之后我的集群关闭,我无法在 postgres 中使用 psql(错误 ~ .s.PGSQL 丢失。文件从默认目录消失)。

chown -R to /snapshot_data_path - 完成,看起来不错。

我认为我的数据库在使用时手动运行:

/usr/lib/postgresql/9.5/bin/postgres -d 3 -D /database/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf 使用新路径。编辑:错误,我可以连接但里面没有数据。

我尝试在互联网上搜索类似的问题 - 没有运气。

是否可以从 1 个 VM 获取数据库并将其与另一个新 VM 连接?还是我必须使用 pg_dump 来实现?

【问题讨论】:

    标签: linux database postgresql


    【解决方案1】:

    这里是关于这个主题的官方文档:https://www.postgresql.org/docs/9.0/backup-file.html

    必须关闭数据库服务器才能获得可用的备份。

    您在拍摄数据快照时是否关闭了服务器?

    【讨论】:

    • 是的,它已停止。我现在花了很多时间在这上面。将方法更改为 pg_dump / pg_restore。还是谢谢你。
    猜你喜欢
    • 2017-11-12
    • 1970-01-01
    • 2020-04-27
    • 2016-07-31
    • 2015-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多