简体   繁体   中英

psql: could not connect to server: Connection refused in Docker to a psql in Windows

My config :

postgreSQL 10 on Windows called "Server A" ip : 192.168.10.11 Docker debian installed on "Server A"

trying to access to the database from the docker :

psql -U postgres -h 192.168.10.11

and then I get the unfamous "psql: could not connect to server: Connection refused"

Checked the C:\\Program Files\\PostgreSQL\\10\\data\\posgresql.conf with

listen_adresses='*'

and

port = 5432

Checked the C:\\Program Files\\PostgreSQL\\10\\data\\pg_hba.conf with

# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             samehost            trust

I've disabled the firewall, not without trying to make some specific rules for the port and for the application. Also tryed : Checked the netstat -an on "Server A" :

TCP    0.0.0.0:5432           0.0.0.0:0              LISTENING

I tryed also to set the log file but no info there. no info inthe event log also. So 'i'm puzzled. Any clue to where I should look for ?

Ok I found the issue. seems that the Ip adresse wasn't the good one. not 192.168.10.11 but 192.168.10.17.

It start tho with a error message like "psql : could not translate host name "example.hotdb.com" to address: Name or service not known"

so I replaced with the IP adresses I thought it should be instead of checking the IP adresse it really was. so a ipconfig gave me the right IP I should psql to and then I connected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM