问题描述
我正在按照https://github.com/2ndQuadrant/pglogical的说明在 Centos 8 上的 postgres 12 上安装pGologic。安装似乎成功:
yum -y install postgresql12-pglogical
Last Metadata expiration check: 0:21:30 ago on Wed 30 Sep 2020 09:32:13 PM CDT.
Dependencies resolved.
=====================================================================================================================================================================================================================================================
Package Architecture Version Repository Size
=====================================================================================================================================================================================================================================================
Installing:
postgresql12-pglogical x86_64 2.3.2-1.el8 2ndquadrant-dl-default-release-pg12 145 k
Installing dependencies:
postgresql12 x86_64 12.4-1PGDG.rhel8 pgdg12 1.6 M
postgresql12-server x86_64 12.4-1PGDG.rhel8 pgdg12 5.2 M
Transaction Summary
=====================================================================================================================================================================================================================================================
Install 3 Packages
Total download size: 7.0 M
Installed size: 29 M
Downloading Packages:
(1/3): postgresql12-12.4-1PGDG.rhel8.x86_64.rpm 1.5 MB/s | 1.6 MB 00:01
(2/3): postgresql12-pglogical-2.3.2-1.el8.x86_64.rpm 117 kB/s | 145 kB 00:01
(3/3): postgresql12-server-12.4-1PGDG.rhel8.x86_64.rpm 4.0 MB/s | 5.2 MB 00:01
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.3 MB/s | 7.0 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : postgresql12-12.4-1PGDG.rhel8.x86_64 1/3
Running scriptlet: postgresql12-12.4-1PGDG.rhel8.x86_64 1/3
Failed to link /usr/bin/psql -> /etc/alternatives/pgsql-psql: /usr/bin/psql exists and it is not a symlink
Failed to link /usr/bin/clusterdb -> /etc/alternatives/pgsql-clusterdb: /usr/bin/clusterdb exists and it is not a symlink
Failed to link /usr/bin/createdb -> /etc/alternatives/pgsql-createdb: /usr/bin/createdb exists and it is not a symlink
Failed to link /usr/bin/createuser -> /etc/alternatives/pgsql-createuser: /usr/bin/createuser exists and it is not a symlink
Failed to link /usr/bin/dropdb -> /etc/alternatives/pgsql-dropdb: /usr/bin/dropdb exists and it is not a symlink
Failed to link /usr/bin/dropuser -> /etc/alternatives/pgsql-dropuser: /usr/bin/dropuser exists and it is not a symlink
Failed to link /usr/bin/pg_basebackup -> /etc/alternatives/pgsql-pg_basebackup: /usr/bin/pg_basebackup exists and it is not a symlink
Failed to link /usr/bin/pg_dump -> /etc/alternatives/pgsql-pg_dump: /usr/bin/pg_dump exists and it is not a symlink
Failed to link /usr/bin/pg_dumpall -> /etc/alternatives/pgsql-pg_dumpall: /usr/bin/pg_dumpall exists and it is not a symlink
Failed to link /usr/bin/pg_restore -> /etc/alternatives/pgsql-pg_restore: /usr/bin/pg_restore exists and it is not a symlink
Failed to link /usr/bin/reindexdb -> /etc/alternatives/pgsql-reindexdb: /usr/bin/reindexdb exists and it is not a symlink
Failed to link /usr/bin/vacuumdb -> /etc/alternatives/pgsql-vacuumdb: /usr/bin/vacuumdb exists and it is not a symlink
Running scriptlet: postgresql12-server-12.4-1PGDG.rhel8.x86_64 2/3
Installing : postgresql12-server-12.4-1PGDG.rhel8.x86_64 2/3
Running scriptlet: postgresql12-server-12.4-1PGDG.rhel8.x86_64 2/3
Installing : postgresql12-pglogical-2.3.2-1.el8.x86_64 3/3
Running scriptlet: postgresql12-pglogical-2.3.2-1.el8.x86_64 3/3
Verifying : postgresql12-pglogical-2.3.2-1.el8.x86_64 1/3
Verifying : postgresql12-12.4-1PGDG.rhel8.x86_64 2/3
Verifying : postgresql12-server-12.4-1PGDG.rhel8.x86_64 3/3
Installed:
postgresql12-12.4-1PGDG.rhel8.x86_64 postgresql12-pglogical-2.3.2-1.el8.x86_64 postgresql12-server-12.4-1PGDG.rhel8.x86_64
Complete!
但是当我尝试重新启动postgres时,出现此错误
systemctl restart postgresql
Job for postgresql.service Failed because the control process exited with error code.
See "systemctl status postgresql.service" and "journalctl -xe" for details.
journalctl -xe
的相关部分-- Unit postgresql.service has begun starting up.
Sep 30 21:54:59 aba postmaster[305963]: 2020-10-01 02:54:59.825 UTC [305963] FATAL: Could not access file "pglogical": No such file or directory
Sep 30 21:54:59 aba postmaster[305963]: 2020-10-01 02:54:59.825 UTC [305963] LOG: database system is shut down
Sep 30 21:54:59 aba systemd[1]: postgresql.service: Main process exited,code=exited,status=1/FAILURE
Sep 30 21:54:59 aba systemd[1]: postgresql.service: Failed with result 'exit-code'.
Sep 30 21:54:59 aba systemd[1]: Failed to start Postgresql database server.
-- Subject: Unit postgresql.service has Failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit postgresql.service has Failed.
--
-- The result is Failed.
我迷路了!
解决方法
您的会话日志告诉您服务器已被安装为前提条件,但是“链接”消息暗示已经存在不兼容的客户端版本。可能您已经从CentOS软件包中安装了PostgreSQL,但是pgologic RPM引入了PGDG软件包。
该错误消息可能意味着shared_preload_libraries
包含pglogical
,但是在pglogical.so
目录中找不到lib
。
大概是安装过程在旧服务器安装中编辑了配置,但在新服务器中安装了共享库。
结果:您不能在安装中使用这些pg二进制文件。要么切换到PGDG RPM,要么从源代码构建pgologic。
您会发现我的推论有一定程度的推测,但这应该可以帮助您解决问题。