Enterprise Edition - Failover Support Using PostgreSQL as Backend DB Server


Follow the steps below to implement failover support in ManageEngine Applications Manager:

Single Database - Dual AppServer Architecture

The setup involves a primary Applications Manager, a secondary Applications Manager and a common database. The primary and secondary Applications Manager refer to the common database only. While the primary Applications Manager talks with the database, the secondary Applications Manager simply listens to the database. If the primary server goes down, the secondary server takes over. Afterward, the initial primary server is restarted and it starts functioning as a secondary server.

Before installing failover (for Managed Servers):
  • Log into Applications Manager's Admin console and go to Managed servers list.
  • Edit the Managed server to enable the radio button for Failover details.
  • Enter the Hostname, Web server and SSL port information before installing the Failover setup for that Managed server.
  • Once it is saved you can start the Failover server installation.

Failover Setup Details

Let us assume we are going to set up three nodes - node1, node2 and node3.
Applications Manager: node1, node2
PostgreSQL Database: node3
 

Diagrammatic expression for Failover Support

STEP 1 - Install PGSQL database Server in node3 and make sure PGSQL Server is started in node3.

Download Applications Manager from our Website. Postgres is bundled with the product and we recommend that you use the bundled software.

Steps to setup remote Postgres DB Server:

  • Install Applications Manager as you would normally do on the remote server where you need to run the DB. Install as Professional Edition as we are only going to use the DB on this installation. (In windows right click and run the installer as "Run as Administrator" Same should be followed when working with command prompt. The Label of command prompt window should read "Administrator")
  • Start this installation once and then stop it.
  • Go to windows services and make sure the ManageEngine Applications Manager service is stopped.
  • From Applications Manager server open an Administrator command prompt window. Go to <Applications Manager Home> folder and execute the below command: shutdownApplicationsManager.bat -force
  • Repeat the above command to ensure that all processes are stopped.
  • In Windows, open a command prompt window and go to ..<Applications Manager Home>/bin folder and run uninstallservice.bat to remove the ManageEngine Applications Manager windows service. We do not need it here as it is going to be DB Server.
  • Changes in pg_hba.conf file:
    • Open pg_hba.conf under ../<Applications Manager Home>/working/pgsql/data/amdb folder.
    • Under # IPv4 local connections, change Address 127.0.0.1/32 to 0.0.0.0/0. (This will allow connections to be made to this PGSQL DB from remote servers.)
  • Changes in postgresql.conf:
    • Open postgresql.conf file in <Applications Manager Home>/working/pgsql/data/amdb folder:
      Uncomment the line listen_addresses and replace localhost with *
  • In Windows, go to <Applications Manager Home>/working/bin folder from command prompt and run the "register_pgdbservice.bat" script. This will install PGSQL as Windows Service.
  • You may now go to Windows Services and start the ApplicationsManager_Posgresql service and the PGSQL DB server should be ready for connections.
  • In Linux you can go to /ManageEngine/<Applications Manager Home>/working folder and run sh./bin/startPGSQL.sh & and the PGSQL DB server should be ready for connections.

STEP 2 - Install Applications Manager in node 1.

  • Install Applications Manager as you would normally do on the remote server. Start this installation at least once and stop it as follows:
    • In Windows services and make sure the ManageEngine Applications Manager service is stopped.
    • From Applications Manager server, open an Administrator command prompt window.
    • Go to <Applications Manager Home> folder and run the following command: shutdownApplicationsManager.bat -force.
    • Repeat the above command to ensure that all processes are stopped.
  • Open the <Applications Manager Home>/conf/AMServer.properties file in Wordpad and update below entries and save it:

    am.dbserver.type=pgsql
    am.db.port=15432 (Port number can be confirmed from the <Applications Manager Home>/working/pgsql/data/amdb/postgres_ext.conf file of the PGSQL DB Server you installed.)
    am.dbport.check=false

  • Update the database_params.conf file shown in below 2 locations.They are identical files.Only change you have to make is for the jdbc URL as shown below. Update the hostname and port of the remote server running your PGSQL DB here.
    • Url jdbc:postgresql://paulp0558:15432/amdbdontTrackOpenResources=true&useUnicode=true&characterEncoding=UTF-8 AppModules TopoDB-MapDB-EventDB-AlertDB-PollDB-PolicyDB-USERSTORAGEDB-ApplnDB
      Update the same for database_params.conf file located in below 2 locations:
      ..<Applications Manager Home>/working/conf/PGSQL
      ..<Applications Manager Home>/working/conf
    • Now you may start Applications Manager from Windows Services.It will be connected to the PGSQL running on the remote server.This will act as the primary server. Check in the <Applications Manager Home>/logs/wrapper.log file.
  • In Linux you can start and track the startup process as follows: nohup sh startApplicationsManager.sh &

    Press ENTER

    tail -f nohup.out

STEP 3 - Install Applications Manager in node2. This will act as Secondary server.

  • Install Applications Manager as you would normally do on the remote server. Start this installation at least once and stop it as follows:
    • In Windows services and make sure the ManageEngine Applications Manager service is stopped.
    • From Applications Manager server open an Administrator command prompt window.
    • Go to <Applications Manager Home> folder
      and run following command: shutdownApplicationsManager.bat -force
    • Repeat the above command to ensure that all processes are stopped.
  • Open the <Applications Manager Home>/conf/AMServer.properties file in Wordpad and update below entries and save it:

    am.dbserver.type=pgsql
    am.db.port=15432 (Port number can be confirmed from the <Applications Manager Home>\working\pgsql\data\amdb\postgres_ext.conf file of the PGSQL DB Server you installed.)
    am.dbport.check=false

  • Update the database_params.conf file shown in below 2 locations. They are identical files. Only change you have to make is for the jdbc URL as shown below.

Update the hostname and port of the remote server running your PGSQL DB here.
Url jdbc:postgresql://paulp0558:15432/amdbdontTrackOpenResources=true&useUnicode=true&characterEncoding=UTF-8 AppModules TopoDB-MapDB-EventDB-AlertDB-PollDB-PolicyDB-USERSTORAGEDB-ApplnDB

  • Update the same for database_params.conf file located in below 2 locations:

    ..<Applications Manager Home>/working/conf/PGSQL
    ..<Applications Manager Home>/working/conf

Now you may start Applications Manager from Windows Services. This installation will not start completely as the Primary is already up and running. It will start and will listen to the Primary Server. The same can be confirmed from the <Applications Manager Home>/logs/wrapper.log file.

Note:
In Linux, you can start and track the startup process as follows:
nohup sh startApplicationsManager.sh &
Press ENTER
tail -f nohup.out

Sample Nohup Output

INFO | jvm 1 | 2013/08/05 01:00:06 | Checking for the availability of the Primary Server in the Database. Found an entry.
INFO | jvm 1 | 2013/08/05 01:00:06 |
INFO | jvm 1 | 2013/08/05 01:00:06 | Trying to connect to the Primary Server at 192.168.1.3
INFO | jvm 1 | 2013/08/05 01:00:06 |
INFO | jvm 1 | 2013/08/05 01:00:07 | Please wait ...
INFO | jvm 1 | 2013/08/05 01:00:08 | ....Connected
INFO | jvm 1 | 2013/08/05 01:00:08 |
INFO | jvm 1 | 2013/08/05 01:00:08 |
INFO | jvm 1 | 2013/08/05 01:00:08 | Starting AdventNet Web NMS Standby Server. The Modules will be started once it takes over as the Primary Server.
INFO | jvm 1 | 2013/08/05 01:00:08 |
INFO | jvm 1 | 2013/08/05 01:00:08 | Monitoring the Primary Server at 192.168.1.3

When node1Applications Manager goes down, node2Applications Manager will start up completely and will act as secondary server. Email notifications will be triggered on occurrence of a failover where you have to correct the issues with the node that is down. Then start it back as secondary which will now listen for another failure.

INFO | jvm 1 | 2013/08/05 01:09:47 | Monitoring the Primary Server at 192.168.1.3
INFO | jvm 1 | 2013/08/05 01:10:48 | Starting to do FailOver Tasks.
INFO | jvm 1 | 2013/08/05 01:11:08 | Process : AlertFE [ Started ]
INFO | jvm 1 | 2013/08/05 01:11:08 | Process : NmsMainFE [ Started ]
INFO | jvm 1 | 2013/08/05 01:11:08 |
INFO | jvm 1 | 2013/08/05 01:11:08 | Verifying connection with web server... verified
INFO | jvm 1 | 2013/08/05 01:11:08 |
INFO | jvm 1 | 2013/08/05 01:11:08 | Applications Manager started successfully.
INFO | jvm 1 | 2013/08/05 01:11:08 |
INFO | jvm 1 | 2013/08/05 01:11:08 | Please connect your client to the web server on port: 9095
INFO | jvm 1 | 2013/08/05 01:11:08 |
INFO | jvm 1 | 2013/08/05 01:11:09 | The new primary server is 192.168.1.4

Note: Above steps need to be implemented for each installation in the Enterprise setup for failover.