无法连接到CitusData-SQLSTATE [08006]错误

时间:2019-07-02 11:44:59

标签: docker citus

我在MAC上遇到CitusData docker版本的问题。

SQLSTATE[08006] [7] could not connect to server: Connection refused 

以下Docker容器列表:

ba187040a5ca        citusdata/citus:8.2.2                "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   5432/tcp                                   citus_worker_1
3105ddb06049        citusdata/membership-manager:0.2.0   "python -u ./manager…"   About a minute ago   Up About a minute (healthy)                                              citus_manager
2cbd2b2bad49        citusdata/citus:8.2.2                "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   0.0.0.0:5433->5432/tcp                     citus_master

docker-compose.yml-https://docs.citusdata.com/en/stable/installation/single_machine_docker.html#post-install     版本:“ 2.1”

services:
  master:
    container_name: "${COMPOSE_PROJECT_NAME:-citus}_master"
    image: 'citusdata/citus:8.2.2'
    ports: ["${MASTER_EXTERNAL_PORT:-5432}:5432"]
    labels: ['com.citusdata.role=Master']
  worker:
    image: 'citusdata/citus:8.2.2'
    labels: ['com.citusdata.role=Worker']
    depends_on: { manager: { condition: service_healthy } }
  manager:
    container_name: "${COMPOSE_PROJECT_NAME:-citus}_manager"
    image: 'citusdata/membership-manager:0.2.0'
    volumes: ['/var/run/docker.sock:/var/run/docker.sock']
    depends_on: { master: { condition: service_healthy } }

1 个答案:

答案 0 :(得分:0)

5433端口似乎是主容器中的问题。 0.0.0.0:5433->5432/tcp。 PostgreSQL默认使用5432端口,这似乎是拒绝连接的原因。

您是否更改了docker-compose.yml中的默认端口映射?也许您设置了MASTER_EXTERNAL_PORT=5433并在尝试访问citus数据库时忘记了使用它。

如果您希望继续使用5433端口,则可以使用psql -U postgres -h localhost -p 5433连接到数据库。