PG :: ConnectionBad(致命:pg_hba.conf拒绝主机"172.17.0.1",用户"XXX",数据库"XXX",SSL关闭的连接): [英] PG::ConnectionBad (FATAL: pg_hba.conf rejects connection for host "172.17.0.1", user "XXX", database "XXX", SSL off ):

查看:121
本文介绍了PG :: ConnectionBad(致命:pg_hba.conf拒绝主机"172.17.0.1",用户"XXX",数据库"XXX",SSL关闭的连接):的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 digitalocean 小滴上的 dockers 在我的项目中使用 postgres:9.4.5 图像.

I am using postgres:9.4.5 image for my project using dockers on digitalocean droplet.

以下是 postgres docker-compose.yml 配置.

db:

  # use the preferred version of the official Postgres image
  # see https://hub.docker.com/_/postgres/
  build: .
  # build with a different Dockerfile
  dockerfile: Dockerfile-pg

  # persist the database between containers by storing it in a volume
  volumes:
    - postgres:/var/lib/postgresql/data
  ports:
    - "5432:5432"
  environment:
    POSTGRES_USER: XXX

Dockerfile-pg 内部,我具有以下配置

Inside Dockerfile-pg i have following configurations

FROM postgres:9.4.5

EXPOSE 5432

何时,我 build 并运行图像,出现以下 error

When, I build and run images I get the following error

PG::ConnectionBad (FATAL:  pg_hba.conf rejects connection for host "172.17.0.1", user "XXX", database "XXX", SSL off ):

我已经设置了以下行以允许 postgresql.conf 文件中的所有连接

I already set the following line to allow all connections in postgresql.conf file

listen_addresses = '*'  

pg_hba.conf 文件中,我还设置了以下行以允许所有连接

inside pg_hba.conf file I also set up following line to allow for all connections

host all all 0.0.0.0/0 trust

我还在本地系统上以相同的 configuration 设置了 local 环境.在我的本地计算机上一切正常.几天前,在 digitalocean 上的服务器上,一切都工作正常.

I also set the local environment with the same configurations on my local system. Everything is working fine on my local machine. Everything was also working fine on server on digitalocean few days back.

我不知道为什么要尝试使用此IP 172.17.0.1 连接.我已经为 postgres 设置了 HOST_IP ,这是我的 drop ip .

I don't know why it is trying to connect with this IP 172.17.0.1. I have set up HOST_IP for postgres which is my droplet ip.

我不知道为什么会出现此错误.我尝试了所有修复方法.

I don't know why I am getting this error. I tried everything to fix it.

请帮助我!

推荐答案

检查您的 pg_hba.conf 文件.您可能有尚未添加的选项,例如

Check you pg_hba.conf file. You might have options that you haven't added such as

host all pgdbadm 0.0.0.0/0 md5

此pgdbadm以加密采矿黑客创建的帐户而闻名.

This pgdbadm is known for account created by crypto-mining hackers.

这篇关于PG :: ConnectionBad(致命:pg_hba.conf拒绝主机"172.17.0.1",用户"XXX",数据库"XXX",SSL关闭的连接):的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆