Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Postgresql Error: psql: could not connect to server: Connection refused Is the server running on host "192.168.100.10" and accepting TCP/IP connections on port 5432?

Cause: The postmaster or PostgreSQL's server daemon process is not running or configured incorrectly.
When you receive this error most of the time it is due to not having PostgreSQL configured to allow TCP/IP connections or at least not connections from your particular workstation. If you have verified that postmaster is indeed running on the host you are trying to connect to then here is a list of common causes to this problem:

Solutions:

1.postgresql.conf not setup to allow TCP/IP connections. You'll want to look at the listen_address configuration parameter.
a)You need to open PostgreSQL configuration file /var/lib/pgsql/data/postgresql.conf

$ vi /var/lib/pgsql/data/postgresql.conf
Now bind and open TCP/IP port by setting tcpip_socket to true:
tcpip_socket = true
Save and close the file.
Restart the PostgreSQL server with the following command
/etc/init.d/postgresql restart
                                                   (OR)
b)Edit postgresql.conf, go to the listen_addresses line, and make it look something like:listen_addresses = 'localhost,192.168.100.10' (Remember to replace 192.168.100.10 with your "inet addr" value from above.)
Restart Postgres via sudo /etc/init.d/postgresql-9.3 restart

2.postgresql.conf is not setup to allow connections on a non-standard port number. To determine this look at the port configuration option.
a)On the server run :
netstat -na
and see if
tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN

if not
edit your postgresql.conf  in your $PGDATA directory
tcpip_socket = true
Restart your server
That should do it.
b)To Determine Whether a Port Is Used

In a terminal window, type /bin/netstat -an | grep portnumber where portnumber is the port number that you want to query. For example:
# /bin/netstat -an | grep 8443
#
If the port is not in use, only the command-line prompt is returned as shown above.
If the port is in reserved or in use, the status of the port is returned. For example:
# /bin/netstat -an | grep 5432
#       *.5432                                Idle
# /bin/netstat -an | grep 8080
# 192.168.100.10.8080         *.*                0      0 24576      0 LISTEN


3.authentication rules in PostgreSQL's access configuration file (pg_hba.conf) are not setup to allow either your uses or IP address to connect to that database. See the documentation for more information on setting up your pg_hba.conf properly.

postgresql pg_hba.conf setup

4.ensure that there are no firewalls, such as iptables that are keeping your local system from even establishing a connection to the remote host
how do we check firewall and perform firewall Operation

Comments

Popular posts from this blog

How to find the server is whether standby (slave) or primary(master) in Postgresql replication ?

7 Steps to configure BDR replication in postgresql

How to Get Table Size, Database Size, Indexes Size, schema Size, Tablespace Size, column Size in PostgreSQL Database

Ora2PG - Oracle/MySQL to Postgres DB migration Version 20.0

PostgreSQL Introduction