How do I setup High Availability configuration with PostgreSQL in JBoss Operations Network?

Solution Verified - Updated -

Environment

  • Red Hat JBoss Operations Network (JON)
    • 3.3.x
  • The PostgreSQL full components on the main JBoss ON server are installed and configured correctly.
  • The PostgreSQL client component on the following JBoss ON servers are installed.

Issue

  • Setup additional JBoss ON servers to use the same PostgreSQL database to join a clustered High Availability environment

Resolution

  • On the first JON server which installs the main PostgreSQL database:

    1. Make sure port 5432 is opened in the firewall policy rule:

      # firewall-cmd --list-all
      

      If the port is not opened, open the port. On RHEL 7.x, use below command:

      # firewall-cmd --permanent --add-port=5432/tcp --permanent
      # firewall-cmd --reload
      
    2. Make sure the rest JBoss ON servers can connect to first PostgreSQL database by opening the listening address in /var/lib/pgsql/9.5/data/postgresql.conf:

      listen_addresses = '*'
      

      For security reasons, it is recommended to use a comma-separated list of addresses instead of ‘*’.

    3. Restart PostgreSQL database service:

      # systemctl restart postgresql-9.5.service
      
  • On the other JBoss ON servers :

    1. Edit the <JON_SERVER_ROOT>/bin/rhq-server.properties, input correct PostgreSQL server information under # PostgreSQL database section
    2. Finish the JBoss ON components installation process and start all components by running:

      $ <RHQ_SERVER_ROOT>/bin/rhqctl install --start
      

Root Cause

Diagnostic Steps

  • If there are errors about No Route to Host during server component installation, the PostgreSQL server firewall does not open the port correctly.
  • If there are errors about Connection refused during server component installation, the PostgreSQL server listen_addresses is not configured correctly.
  • On the following JBoss ON servers, use below steps to diagnose this issue:

    1. Confirm the port is opened on the main JBoss ON server:

      telnet <PostgreSQL Server> 5432
      
    2. Test the connection to remote PostgreSQL:

      # su – postgres
      $ psql –h <PostgreSQL Database Server Hostname/IP address> rhq –-username <user name>
      

      Once you can log in to the command line interface, the connection to the PostgreSQL server is successful.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.