postgresql 重启失败

由于重启服务器,需要重新启动 postgres

之前重新映射postgres的data目录为其他数据盘,重启的时候出现以下错误

5月 27 14:36:30 xydc-pre01 systemd[1]: Starting PostgreSQL 12 database server...
-- Subject: Unit postgresql-12.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit postgresql-12.service has begun starting up.
5月 27 14:36:30 xydc-pre01 postgresql-12-check-db-dir[10368]: "/var/lib/pgsql/12/data/" is missing or empty.
5月 27 14:36:30 xydc-pre01 systemd[1]: postgresql-12.service: control process exited, code=exited status=1
5月 27 14:36:30 xydc-pre01 postgresql-12-check-db-dir[10368]: Use "/usr/pgsql-12/bin/postgresql-12-setup initdb" to initialize the database cluster.
5月 27 14:36:30 xydc-pre01 postgresql-12-check-db-dir[10368]: See /usr/share/doc/postgresql12-12.5/README.rpm-dist for more information.
5月 27 14:36:30 xydc-pre01 systemd[1]: Failed to start PostgreSQL 12 database server.
-- Subject: Unit postgresql-12.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit postgresql-12.service has failed.
-- 
-- The result is failed.
5月 27 14:36:30 xydc-pre01 systemd[1]: Unit postgresql-12.service entered failed state.
5月 27 14:36:30 xydc-pre01 systemd[1]: postgresql-12.service failed.
5月 27 14:36:30 xydc-pre01 polkitd[596]: Unregistered Authentication Agent for unix-process:10361:1070035 (system bus name :1.1214, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)
5月 27 14:36:32 xydc-pre01 polkitd[596]: Registered Authentication Agent for unix-process:10434:1070303 (system bus name :1.1215 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8)
5月 27 14:36:32 xydc-pre01 polkitd[596]: Unregistered Authentication Agent for unix-process:10434:1070303 (system bus name :1.1215, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale zh_CN.UTF-8) (disconnected from bus)

由于数据库需要快速恢复,查验了/var/lib/pgsql/12/data/,就是把原来的数据拷贝回原来的目录,还是失败。

由于使用的是 root 用户进行操作的,拷贝完之后,还是不能重启

明明已经存在,但是还是有问题。

"/var/lib/pgsql/12/data/" is missing or empty.

最后发现是当前目录没有权限

chown -R  postgres:postgres /var/lib/pgsql/12/data

然后数据库重启成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值