0

I am trying to connect GeoServer to a PostGres Database with PostGIS extensions installed, but I need to use the host name becauuse the IP address may change. I am running geoserver and postgis in linked docker containers (see https://docs.docker.com/userguide/dockerlinks/), and restarting a container may result in a change of IP address. However, I have full control over the hostname. My /etc/hosts contains the entry:

172.17.0.244    postgis

If I configure GeoServer to use host 172.17.0.244 it connects fine, but if I specify postgis if doesn't connect. Is this just not possible with GeoServer, or am I doing something wrong?

  • 1
    Something else is wrong. I have sucessfully configured Geoserver to use PostgreSQL defined via hostnames. It might be possible that your firewall, or routing tables prevent routing via domain names/ hostnames. – Devdatta Tengshe Sep 26 '14 at 10:14
1

By default, Postgres allows access from only local users on the same server, since you can connect via an Ip Address, you must have configured some security already, so to allow the hostname, you should only need to do the following ..

Edit your pg_hba.conf file for your PostGres installation add the following entry

# Allow any user from hosts in the example.com domain to connect to
# any database if the user's password is correctly supplied.
#
# TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             postgis                 md5

You can refer Postgres documentation Here! for detailed security options.

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.