Postgresql Sqitch无法连接到正在运行的Postgres实例

Postgresql Sqitch无法连接到正在运行的Postgres实例,postgresql,sqitch,Postgresql,Sqitch,我在OSX上有一个Postgres 9.6实例,该实例已启动并正在运行,但是当我在一个工作目录中使用Sqitch.conf尝试Sqitch status时,Sqitch抛出以下错误: $ sqitch status # On database db:pg:my_db could not connect to server: No such file or directory Is the server running locally and accepting c

我在OSX上有一个Postgres 9.6实例,该实例已启动并正在运行,但是当我在一个工作目录中使用
Sqitch.conf
尝试
Sqitch status
时,Sqitch抛出以下错误:

$ sqitch status
# On database db:pg:my_db
could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
这很奇怪,因为我已经通过检查Postgres的状态并直接登录来检查它是否正在运行:

$ pg_isready 
/tmp:5432 - accepting connections

$ psql -U postgres
psql (9.6.19)
Type "help" for help.
postgres=#
这似乎只是
sqitch
的一个问题

有关更多详细信息,此Postgres是通过
brew安装安装的postgresql@9.6
并位于默认目录中:

$ which psql
/usr/local/opt/postgresql@9.6/bin/psql
关于Sqitch,我已经尝试过使用自制软件和Docker(我目前的方法)进行安装。docker安装基于官方说明:

docker pull sqitch/sqitch
curl -L https://git.io/JJKCn -o sqitch && chmod +x sqitch
./sqitch status
我尝试过使用
sqitch config--user engine.pg.client/usr/local/opt显式地设置
psql
/postgresql@9.6/bin/psql

无论如何,我仍然可以通过任何
sqitch
命令获得以下信息:

$ sqitch status
# On database db:pg:my_db
could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

我不确定我遗漏了什么,可能需要一些输入。提前感谢。

我不知道Brew安装的Sqitch是怎么回事,但是当您从Docker映像运行它时,该容器中没有运行Postgres,因此与localhost的连接将失败。相反,您需要连接到容器外部的Postgres。如果您在Mac上运行它,这是很简单的:确保,不仅仅是一个Unix域套接字,并且,像这样:

sqitch status db:pg://host.docker.internal/my_db

请参阅Unix域套接字上的连接/var/run/postgresql/.s.PGSQL.5432vs
/tmp:5432-接受连接
。这通常发生在针对不同版本的
libpq
编译或链接程序时。我会尝试将您的连接改为指向
localhost
,而不是套接字(本地)。