0

i am running a postgresql instance in my host machine (Mac OS). I am able to access this instance by JDBC using localhost property in my Spring Boot application

Now i have a guest Ubuntu Virtual Box OS installed. and i want to install the same instance from this OS.

So i just changed the data source url of the same application from localhost to the host ip and port . But now when i deploy the application and try to run it, i get "connection refused" error.

Telnet to host os from guest OS (10.0.2.2 5432) is working fine.

Content from my pg_hba.conf file

    # TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     md5
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#local   replication     postgres                                md5
#host    replication     postgres        127.0.0.1/32            md5
#host    replication     postgres        ::1/128                 md5
host    all             all              0.0.0.0/0                       md5
host    all             all              ::/0                            md5

Connections and authentications content from my postgresql.conf

    #------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------

# - Connection Settings -

listen_addresses = '*'              # what IP address(es) to listen on;
                    # comma-separated list of addresses;
                    # defaults to 'localhost'; use '*' for all
                    # (change requires restart)
port = 5432             # (change requires restart)
max_connections = 100           # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/tmp'   # comma-separated list of directories
                    # (change requires restart)
#unix_socket_group = ''         # (change requires restart)
#unix_socket_permissions = 0777     # begin with 0 to use octal notation
                    # (change requires restart)
#bonjour = off              # advertise server via Bonjour
                    # (change requires restart)
#bonjour_name = ''          # defaults to the computer name
                    # (change requires restart)

So i have configured my postgrsql instance to accept connections from any IP.

i am behind a firewall.

Probably i am still missing somethings

Best Regards, Saurav

S-Man
  • 22,521
  • 7
  • 40
  • 63
saurav
  • 5,388
  • 10
  • 56
  • 101

1 Answers1

0

This was a problem with my configuration of Spring Boot and Cloud Foundry..it was nowhere related to Postgresql.

Curious readers please head over to No unique service maching interface error in Spring Boot Cloud Foundry error for the solution

saurav
  • 5,388
  • 10
  • 56
  • 101