OpenNMS will not start if unable to connect to the database as "postgres" (admin) user

Description

If you change the opennms-datasources file to point to a IP other than localhost, the script exists with the following message:

[opennms@localhost daemon]$ sudo /opt/opennms/bin/opennms start
Starting OpenNMS: OpenNMS runs better if you start up the database first.
[FAILED]

Verified this today on 3 installations during class that were trying to separate the DB server from the NMS. Just verified on a local system by configuring opennms to connect to an actual IP on the local system. This failed also. No logs! Just an exit code of 1 is returned from the boostrap.jar main when passed the "check" parameter.

Environment

Latest build of 1.8.8 on CentOS 5.5 Linux with PostgreSQL 8.1

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Benjamin Reed February 7, 2011 at 2:59 PM

Alright, done. An outright failure to connect to the 'opennms' database will fail outright. Any other issues with databases or configuration in opennms-datasources.xml will warn in the $OPENNMS_HOME/logs/controller/controller.log

[1.8 a1a0c51] failure to connect to admin db on startup should be non-fatal
[master cec392e] failure to connect to admin db on startup should be non-fatal

Benjamin Reed February 7, 2011 at 1:55 PM

Wow, was that even english? To reiterate:

The postgres user should only need to be able to connect during installation – during runtime, we do not need the admin user.

Therefore, we should not require the "opennms-admin" database be connectable at runtime, although it may still be a good idea to warn if it's not.

David Hustace February 7, 2011 at 1:16 PM

FYI, this is the same issue I found. If you fix pg_hba.conf to allow the "admin" configuration to access the DB, then the problem goes away. Having some output from the Exception would probably help debug the issue.

David Hustace February 7, 2011 at 1:14 PM

Could you also make a change that causes the "check" option to the bootstrap jar to print the reason rather than just exit(1)?

Thanks,
David

Benjamin Reed February 7, 2011 at 1:12 PM

Oooooh, I see. So you're not saying that you can't connect to the opennms database remotely, only as the admin database. And you're right, the admin database is only used for install.

Valid complaint, I will change the code. =)

Fixed

Details

Assignee

Reporter

Due date

Original estimate

Time tracking

No time logged2h remaining

Components

Fix versions

Affects versions

Priority

PagerDuty

Created February 4, 2011 at 3:49 PM
Updated January 27, 2017 at 4:21 PM
Resolved August 14, 2012 at 2:05 PM