I've come across different versions of this same issue on stackoverflow and on this forum. I've tried the recommendations posted on these forums but I am still unable to connect to a database. I've run out of leads to try and I'm hoping someone can explain to me what is happening and why I am unable to connect. The context of my question follows:
I pg_dumped a database on a server host named test-crawl-1 and have pg_restored the database onto a new server host named test-qa-db where it resides with 4 other databases. I've changed the database. yml file to look like this:
testing:
db_host: test-qa-db
db_port: 5432
db_name: testing
db_user: user
db_pass: password
Next, because of the error I'm receiving I tried the following, I sshed into a VM named test-utility-1 and modified the pg_hba.conf file there to reflect the following:
# 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 md5
# IPv6 local connections:
host all all ::1/128 md5
#Trying to fix the SSL error
host all all 0.0.0.0/0 md5
Then I tried this:
# 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 md5
# IPv6 local connections:
host all all ::1/128 md5
#Trying to fix the SSL off error attempt 2
local all all (test-utility-1 address)10.1.1.1/32 md5
And then I tried to implement in the postgresql.conf file:
postgresql.conf
listen_addresses = "*"
I pretty much tried that line with the above variations but I have still yet been able to make it work. Is there anything that I'm missing. I'm not sure what else is there to try. Help would be appreciated thank you.
————EDIT———-
I forgot to mention that I also hard coded the database, user, and Ip address into the corresponding fields but the SSl but the error still persists.
Best Answer
Thanks for the reply @Imarin. I figured it out. I was configuring the wrong pg_hba.conf file. I needed to configure the file in test-qa-db because that was where the database resided.