CentOS 7 pg_upgrade Permissions Errors

房东的猫 提交于 2019-12-24 01:36:14

问题


I'm trying to migrate PostgreSQL from 9.2 to 10.2 on CentOS 7

I've installed the new version, and I'm trying to implement the changeover:

/usr/pgsql-10/bin/pg_upgrade --old-datadir /var/lib/pgsql/data/ --new-datadir /var/lib/pgsql/10/data/ \
--old-bindir /usr/bin/ --new-bindir /usr/pgsql-10/bin/

The error I'm getting is:

could not open version file: /var/lib/pgsql/data/PG_VERSION
Failure, exiting

I try as root, and pg_upgrade cannot be run as root.

/var/lib/pgsql belongs to postgres:postgres so I'm at a bit of a loss how I can get this done.

Do I have to be a certain user to upgrade PostgreSQL using pg_upgrade? How do I proceed to get this switched over to v10.2? I'm sure it's something I'm overlooking and simple.


回答1:


You must run pg_upgrade as the user that owns both the new and the old data directories. That user is typically postgres.

If /var/lib/pgsql/data/PG_VERSION does not exist, /var/lib/pgsql/data is no PostgreSQL data directory.



来源:https://stackoverflow.com/questions/53166580/centos-7-pg-upgrade-permissions-errors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!