HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Trouble setting up Postgres for the first time

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thepostgrestimesettingfirstfortrouble

Problem

I have some, albeit limited, experience with MySQL and MongoDB (both running fine on server) but having trouble with Postgres and find the documentation lacking for newbies, like myself.

Postgres is installed and running. But I cannot connect from a client.

pg_hba.conf looks like this (I added the last line):

# TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

## Added by me
host    all             all             10.0.1.201/32           trust


Now if I go to the client 10.0.1.201 and try to psql -h server.domain.com I get an error:

psql: could not connect to server: Connection refused
    Is the server running on host "server.domain.com" (10.0.1.38) and accepting
    TCP/IP connections on port 5432?


ssh authorized_keys are setup for this client server connection. There is also Kerberos as an option. Seems I might have too many options here? Not quite sure how to troubleshoot this? I can verify Postgres IS running.

meltemi$ sudo lsof -i -P | grep -i ':5432'
meltemi$


leads me to believe maybe it's not listening?

ideas?

Solution

The next thing to check is probably that you have a line in your postgresql.conf that looks like this:

listen_addresses = '*'


You will have to restart after changing that line. Otherwise your pg_hba.conf looks fine.

Good luck! Getting started is a big hurdle, but once you get through it, you will probably find that compared to MySQL things are a lot simpler and more consistent.

Code Snippets

listen_addresses = '*'

Context

StackExchange Database Administrators Q#14168, answer score: 6

Revisions (0)

No revisions yet.