我在OSX上有一个Postgres9.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的状态并直接登录来检查Postgres正在运行:
$ pg_isready
/tmp:5432 - accepting connections
$ psql -U postgres
psql (9.6.19)
Type "help" for help.
postgres=#这似乎只是sqitch的一个问题。
有关更多详细信息,此Postgres是通过brew install postgresql@9.6安装的,位于默认目录中:
$ which psql
/usr/local/opt/postgresql@9.6/bin/psql关于Sqitch,我已经尝试过使用Homebrew安装和使用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/postgresql@9.6/bin/psql显式设置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"?我不确定我错过了什么,可以使用一些输入。提前谢谢。
发布于 2021-01-10 02:22:47
我不知道Brew安装的Sqitch出了什么问题,但当您从Docker镜像运行它时,该容器中没有运行Postgres,因此与localhost的连接将失败。相反,您需要连接到容器外部的Postgres。如果你在你的苹果电脑上运行它,这很简单:确保Postgres is listening on the IP ports,而不仅仅是一个Unix域套接字,和specify host.docker.internal as the host name,如下所示:
sqitch status db:pg://host.docker.internal/my_dbhttps://stackoverflow.com/questions/64560488
复制相似问题