Update!


I got it fixed! Here's how in case someone else runs into the same problem:



1) Made some changes to opennms-datasource.xml:



Replaced localhost in jdbc:postgresql://localhost:5432/ with the actual IP



2) In postgresql.conf, replace "localhost" in listen_addresses = 'localhost' to 
"*"

Also, commented in the line where reads port=5432



3) In pg_hba.conf, added a new line which reads:

host    all         all         [machine's IP]   255.255.255.255          trust



4) Running su postgres command, I realized the owner of OpenNMS
database is postgres so I didn't make any changes to the username and
password used by jdbc connection...



5) sudo -u postgres pg_ctl -D /var/lib/pgsql/data restart



6) Now I could run $OPENNMS_HOME/bin/install -dis with no problem :-)


Will report back if something else happens during the process.

Thanks


 



From: honia2...@hotmail.com
To: opennms-devel@lists.sourceforge.net
Date: Fri, 9 Jan 2009 14:14:49 -0500
Subject: [opennms-devel] PostgreSQL problem - Could not get an administrative 
connection to the database








Hi all,


I am in the process of installing OpenNMS on my CentOS machine. Followed the 
instruction provided on this website to install OpenNMs: 
http://www.opennms.org/index.php/Installation:Yum
 

As a part of this process, I installed postgresql-server using yum command and 
when I was configuring it, I ran into some problem. Just like the instruction 
has suggested, at some point, had to edit pg_hba.conf and postgresql.conf 
located in /var/lib/pgsql/data directory. 

- In pg_hba.conf, I replaced all ident sameuser with trust to allow postgres to 
authenticate, this is how it looks like now:


# 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


- In postgresql.conf, I made some changes to allow TCP/IP connections:
listen_addresses = 'localhost'

After
that, every time I try to start the postgres, it fails to start the service. If 
I replace 'localhost' with '*' to listen on all addresses, I can start postgres 
service with no problem.

But
when I get to the step where I should initialize OpenNMS and database
(I already created a database called opennms) by running 
$OPENNMS_HOME/bin/install -dis command, get a long error message which I paste 
the important lines below. 

Just to test, I ping
localhost which fails (ping 127.0.0.1 works fine, so I tried replacing the
listen to localhost with listen to the IP but no luck).

I created my
own log file here: /var/log/postgres.log so that it shows me what the problem 
really is...

This is part of the error message I get when trying to run the 
$OPENNMS_HOME/bin/install -dis command I mentioned above:

Could not get an administrative connection to the database.  Is the database 
running, 
listening for TCP connections, and allowing us to connect and authenticate from 
localhost? 
Tried connecting to database specified by data source SimpleDataSource
[URL='jdbc:postgresql://localhost:5432/template1', driver 
class='org.postgresql.Driver', 
properties: user='postgres', password='']

This is my opennms-datasource.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<datasource-configuration 
xmlns:this="http://xmlns.opennms.org/xsd/config/opennms-datasources";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://xmlns.opennms.org/xsd/config/opennms-datasources
                      http://www.opennms.org/xsd/config/opennms-datasources.xsd 
">
  <jdbc-data-source name="opennms"
                    database-name="opennms"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/opennms"
                    user-name="opennms"
                    password="opennms" />

  <jdbc-data-source name="opennms-admin"
                    database-name="template1"
                    class-name="org.postgresql.Driver"
                    url="jdbc:postgresql://localhost:5432/template1"
                    user-name="postgres"
                    password="" />
</datasource-configuration>
Am I missing something? Please help! 

Thanks in advance,honia




 


Windows Live™: Keep your life in sync.  Check it out.
_________________________________________________________________
Windows Live™: Keep your life in sync. 
http://windowslive.com/howitworks?ocid=TXT_TAGLM_WL_t1_allup_howitworks_012009
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to