Fedora 28 无法将 Postgres 升级到 10

Fedora 28 无法将 Postgres 升级到 10

在 Fedora 28 上启动 Postgres 服务器时,出现此错误:

May 25 14:36:14 localhost.localdomain systemd[1]: Starting PostgreSQL database server...
May 25 14:36:14 localhost.localdomain postgresql-check-db-dir[11816]: An old version of the database format was found.
May 25 14:36:14 localhost.localdomain postgresql-check-db-dir[11816]: Use 'postgresql-setup --upgrade' to upgrade to version '10'
May 25 14:36:14 localhost.localdomain postgresql-check-db-dir[11816]: See /usr/share/doc/postgresql/README.rpm-dist for more information.
May 25 14:36:14 localhost.localdomain systemd[1]: postgresql.service: Control process exited, code=exited status=1
May 25 14:36:14 localhost.localdomain systemd[1]: postgresql.service: Failed with result 'exit-code'.
May 25 14:36:14 localhost.localdomain systemd[1]: Failed to start PostgreSQL database server.

运行升级后我得到:

[root@localhost lib]# postgresql-setup --upgrade
 * Upgrading database.
ERROR: pg_upgrade tool failed
ERROR: Upgrade failed.
 * See /var/lib/pgsql/upgrade_postgresql.log for details.

然后日志文件显示:

...
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 
*failure*

Consult the last few lines of "pg_upgrade_utility.log" for
the probable cause of the failure.
Failure, exiting

(为什么这感觉像是寻宝……?),然后那条日志给了我:

...
command: "/usr/bin/psql" --echo-queries --set ON_ERROR_STOP=on --no-psqlrc --dbname=template1 --host /var/lib/pgsql --port 5432 --username postgres -f "pg_upgrade_dump_globals.sql" >> "pg_upgrade_utility.log" 2>&1
/usr/bin/psql: symbol lookup error: /usr/bin/psql: undefined symbol: PQencryptPasswordConn

啊!显然我遗漏了一些符号。但是,如何获取该符号呢?

答案1

事实证明,我有一些旧的 Postgres 库可用:

[root@localhost pgsql]# ldd $(which psql)
    linux-vdso.so.1 (0x00007ffc3317a000)
    libpq.so.5 => /usr/pgsql-9.6/lib/libpq.so.5 (0x00007f27a2913000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f27a26f4000)
    libreadline.so.7 => /lib64/libreadline.so.7 (0x00007f27a24a7000)

如您所见,libpq指向旧版本。只需删除整个目录即可解决问题。inlibpq具有/lib64/正确的符号,我的升级运行正常。

相关内容