双 Postgres 实例 config_file 问题

Dual Postgres Instances config_file issue

我有一个服务器,其中有一个我正在使用的 postgres 9.4 实例。 我安装了另一个版本的 postgres (9.6),但遇到了一个问题。

为了初始化新数据库,我 运行

sudo -u postgres /usr/pgsql-9.6/bin/initdb -D /var/lib/pgsql/9.6/data/

但是当我检查 sql 时,我得到以下信息。

sudo -u postgres /usr/pgsql-9.6/bin/psql
psql (9.6.9, server 9.4.18)
Type "help" for help.

postgres=# SHOW config_file;
               config_file               
-----------------------------------------
 /var/lib/pgsql/9.4/data/postgresql.conf

我可以看到它正在使用我的 9.4,但我不确定如何解决这个问题,也没有找到任何指示如何解决的资源。

如有任何帮助,我们将不胜感激。

9.4 postgres 使用默认端口,我猜你为 postgres 9.6 设置了另一个端口。

使用 psql -P xxxx 连接到它,其中 xxxx 是 9.6 端口号。