0

我在 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 } }
4

1 回答 1

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连接到数据库。

于 2019-07-16T11:45:03.463 回答