0

I am using GeoNode with connection to Geoserver through Docker.(from here: https://github.com/GeoNode/geonode).

I am now trying to connect to a PostGIS database. I have indicated the host ip address 172.17.0.1 on docker network, using the "ip addr show" in Terminal. The port stays same: 5432.

When trying to connect I get the error message: "Error creating data store, check the parameters. Error message: Unable to obtain connection: Cannot create PoolableConnectionFactory (Connection to 172.17.0.1:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.)".

What could be the solution?

4
  • did you update the pg_hba.conf file to make sure postmaster is accepting remote connections? updated pg_conf to set listen to *? Can you connect using psql from the geoserver machine to the postgis one?
    – Ian Turton
    Jul 23, 2020 at 13:45
  • yes I edited pg_hba.conf file, like its written here: docs.geonode.org/en/2.8/tutorials/install_and_admin/… I don't understand the last question. Would be nicer to see visually how it should look like. (e.g. screenshot).
    – Set
    Jul 23, 2020 at 14:48
  • 1
    psql is a command line tool for talking to remote (and local) postgres/postgis servers - you'd log on and type something like psql -U username -h 172.17.0.1 -p 5432 if it says it can't connect then you have a postgis problem if it can connect then you have a geoserver problem
    – Ian Turton
    Jul 23, 2020 at 15:43
  • 1
    don't forget to open the firewall to allow connections on this port
    – JGH
    Jul 23, 2020 at 16:34

1 Answer 1

0

Assuming that you have both the PostGIS and the Geoserver together in one docker-compose.yaml file, they are already in the same network. That said you don't need an IP address to connect a new PostGIS store in Geoserver to the PostGIS database running in the second docker. If your PostGIS Docker is up and running and you can connect to it via e.g. DBeaver or QGIS with your credentials e.g.:

host: localhost
host: 5432
database: test
username: postgis
password: secret

then your solution might be, that you need to change the hostname to the container_name you assigned to your PostGIS in the docker-compose.yaml since this is how the PostGIS is known in the docker-compose network.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.