I'm trying to connect to my Postgres instance on a local IP, which I can connect to with no problem using the psql -h localhost
command. However, which trying to run via rails, I get this:
$ rails c production
/home/avishai/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.9/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize': could not connect to server: Connection refused (PG::Error)
Is the server running on host "10.61.99.194" and accepting
TCP/IP connections on port 5432?
Here's my /etc/postgresql/9.1/main/pg_hba.conf
:
# DO NOT DISABLE!
# If you change this first entry you will need to make sure that the
# database superuser can access the database using some other method.
# Noninteractive access to all databases is required during automatic
# maintenance (custom daily cronjobs, replication, and similar tasks).
#
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 10.80.85.130/32 trust
host all all 10.80.85.130/32 md5
# IPv6 local connections:
host all all ::1/128 md5
How do I make sure that Postgres can accept incoming connections from localhost as well as on select internal IPs?