By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,117 Members | 1,093 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,117 IT Pros & Developers. It's quick & easy.

Postgres can't talk on TCP/IP connection

P: 2
Building OpenNMS 1.2.9 on
OpenSUSE 10.3 using
Postgres 8.2.7

When I run:
$OPENNMS_HOME/bin/install -disU

Output is:
Exception in thread "main" org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.jdbc1.AbstractJdbc1Connection.openC onnection(AbstractJdbc1Connection.java:204)
at org.postgresql.Driver.connect(Driver.java:139)
at java.sql.DriverManager.getConnection(DriverManager .java:525)
at java.sql.DriverManager.getConnection(DriverManager .java:171)
at org.opennms.install.Installer.databaseConnect(Inst aller.java:613)
at org.opennms.install.Installer.install(Installer.ja va:195)
at org.opennms.install.Installer.main(Installer.java: 2450)


The research I've done suggests:
Edit pg_hba.conf to Allow postgres to Authenticate

You will need to change "ident sameuser" to "trust":
local all all trust
host all all 127.0.0.1/32 trust
host all all ::1/128 trust

local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust

Edit postgresql.conf to Allow TCP/IP Connections

You may also need to change the postgresql.conf to allow TCP/IP connections, if it cannot do so already. On older PostgreSQL versions, this is enabled with the flag:
On newer PostgreSQL versions, this is enabled with:

# you can use "*" to listen on all addresses
listen_addresses = 'localhost'

I made all change and I restarted postgres with:
sudo -u postgres /opt/pgsql/bin/pg_ctl -D /opt/pgslq/data -l /opt/pgsql/logfile start

and re-ran
$OPENNMS_HOME/bin/install -disU
But received the same error. I'm at a wall with no other idea's and nothing left to google. Any suggestions?
Jul 24 '08 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 700
so i guess you have in postgresql.org
Expand|Select|Wrap|Line Numbers
  1. listen_addresses='*'
  2.  
don't you?

and put in pg_hba.conf
Expand|Select|Wrap|Line Numbers
  1. host all all 0.0.0.0/0 trust
  2.  
restart postgres server
check, what port does postgres listening on.

does i work?
Jul 24 '08 #2

P: 2
so i guess you have in postgresql.org
Expand|Select|Wrap|Line Numbers
  1. listen_addresses='*'
  2.  
don't you?

and put in pg_hba.conf
Expand|Select|Wrap|Line Numbers
  1. host all all 0.0.0.0/0 trust
  2.  
restart postgres server
check, what port does postgres listening on.

does i work?

In postgresql.conf I put:
listen_addresses = 'localhost'
port = 5432
max_connections = 256
shared_buffers = 1024MB
max_fsm_pages = 204800


In pg_hba.conf
I put:
# 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

# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
host all all 127.0.0.1 255.255.255.255 trust
host all all ::1 ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff trust

and restarted DB with:
sudo -u postgres /opt/pgsql/bin/pg_ctl -D /opt/pgslq/data -l /opt/pgsql/logfile start

I am a very new newbie. I put in above statements in as the documentation suggests. But still getting same error. is the info I put in correct? Did I start the DB with the right command?
Jul 24 '08 #3

Expert 100+
P: 700
read carefully i wrote

in postgresql.conf set
Expand|Select|Wrap|Line Numbers
  1.       listen_addresses='*'
  2.  
in pg_hba.conf

Expand|Select|Wrap|Line Numbers
  1.       host all all 0.0.0.0/0 trust
  2.  
and restart postgres server
As you said you are a begginer so i think you should read manual at postgresql.org
To restart you should use option restart not start
Jul 24 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.