CentOS 7 pg_upgrade 权限错误 [英] CentOS 7 pg_upgrade Permissions Errors
问题描述
我正在尝试在 CentOS 7 上将 PostgreSQL 从 9.2 迁移到 10.2
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/
我得到的错误是:
could not open version file: /var/lib/pgsql/data/PG_VERSION
Failure, exiting
我以 root 身份尝试,pg_upgrade
无法以 root 身份运行.
I try as root, and pg_upgrade
cannot be run as root.
/var/lib/pgsql
属于 postgres:postgres,所以我有点不知所措.
/var/lib/pgsql
belongs to postgres:postgres so I'm at a bit of a loss how I can get this done.
我必须是某个用户才能使用 pg_upgrade
升级 PostgreSQL 吗?我如何继续将其切换到 v10.2?我敢肯定这是我忽略的事情,而且很简单.
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.
推荐答案
您必须以拥有新旧数据目录的用户身份运行 pg_upgrade
.该用户通常是 postgres
.
You must run pg_upgrade
as the user that owns both the new and the old data directories. That user is typically postgres
.
如果 /var/lib/pgsql/data/PG_VERSION
不存在,则 /var/lib/pgsql/data
不是 PostgreSQL 数据目录.
If /var/lib/pgsql/data/PG_VERSION
does not exist, /var/lib/pgsql/data
is no PostgreSQL data directory.
这篇关于CentOS 7 pg_upgrade 权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!