opHA-MB 5.0 Installation (Replication)

Replication Setup and Configuration Guide

 



opHA-MB 5.0 introduces the concept of a Primary & multiple Poller servers and a message bus (with replication):

  • The Primary is the server that keeps the information of all the pollers and it is where we can read all the information from. The Consumer (ophad running on Primary) reads data continuously off the message bus and stores it in the database

  • The Producer (ophad running on Pollers) has a change stream setup for the collections and receives update from the database if there is any. This change stream data is pushed onto the message bus.

  • With Replication and Nats if the Main Primary goes down the secondary primary will take over also if a poller goes down the mirror will take over.

image-20241108-042057.png

Here are terms used in this project together with their meanings.

Term

Meaning

Term

Meaning

Main Primary

server instance running opHA with role = 'primary_master'

Secondary Primary

server instance running opHA with role = 'master'. Also referred to as just 'primary'.

Peer

server instance running opHA with role = 'poller' or 'mirror'. It can optionally be of type 'streaming' which means that it is linked to an ophad instance.

Poller

server instance running opHA with role = 'poller'

Mirror

server instance running opHA with role = 'mirror'. It is paired with a poller and polls the same devices as that poller, however its data is not sync'd with primary unless the poller is offline.

Producer

an instance of the ophad process running in 'producer' mode (as per configuration). This will typically be running on the same server instances as the primary.

Consumer

an instance of the ophad process running in 'consumer' mode (as per configuration). This will typically be running on the same server instance as the poller (or mirror)

1. Software Installation

1.1 Download Software

Download the required software onto each server.

1.2 Install Software

IMPORTANT: All the servers should be setup with the following

a. opHA 4 needs to be currently installed

b. Pollers and mirrors discovered by the Main Primary

c. Server names set

d. Secondary Primary server setup as Primary

e. One server needs to be an Arbiter. A poller can be used for this

f. MongoDB 6 installed

We will be using the below example host names throughout this guide.

You would replace with your own where applicable. For this example we have the required 6 servers for the setup.

IMPORTANT:

One server should be set as an Arbiter and in this example we are using Poller1 Server

Main Primary Server: opha-dev1.opmantek.net

Poller1 Server: opha-dev2.opmantek.net [Arbiter Server]

Mirror1 Server: opha-dev3.opmantek.net

Poller2 Server: opha-dev4.opmantek.net

Mirror2 Server: opha-dev5.opmantek.net

Second Primary: opha-dev6.opmantek.net

Run the installation commands on each server as needed.

All the following setup commands in this setup should be run as the root user

sh ./<executable>

e.g

sh ./opHA-Linux-x86_64-5.0.0.run

 

During the installation of the arbiter server you must answer 'n' at the following prompt

install-arb2.PNG

2. NATS Setup

This configuration should be applied to the Main Primary, Arbiter and Secondary Primary servers ONLY.

  1. Edit Configuration: Update the /etc/nats-server.conf file with the following settings:

    server_name: "opha-dev1.opmantek.net" #The local server http_port: 8222 listen: 4222 jetstream: enabled accounts { $SYS { users = [ { user: "admin", pass: "password" } ] } ophad: { users: [ { user: "omkadmin", password: "op42opha42" } ] jetstream: enabled } } jetstream { store_dir: "/opt/nats/storage" max_memory_store: 1028M max_file_store: 1028M } cluster { name: "C1" host: "opha-dev1.opmantek.net" #The current host # the current server listen: "0.0.0.0:6222" routes: [ # secondary primary "nats://opha-dev6.opmantek.net:6222" # server with the arbiter "nats://opha-dev2.opmantek.net:6222" # other servers ] }

     

3. Common Configuration for All Servers

3.1 Update /usr/local/omk/conf/opCommon.json

  1. Backup Configuration: Make a backup copy of the opCommon.json file before making any changes.

  2. Add NATS Cluster Configuration: Ensure the following configuration is included in opCommon.json on all servers. In the below example we have added the Main Primary, arbiter and Secondary Primary FQDNs and port/s to be utilized in the nats_cluster attribute, you can find this in the database section.

     

4. Server-Specific Configuration

4.1 Update /usr/local/omk/conf/opCommon.json for Main Primary and Secondary Primary only

5. Update License

To obtain a license please contact FirstWave Sales.

Currently there are 2 available licenses and Message Bus will not run without a license.

  1. opHA-MB for NMIS & opCharts (This license is required for Message Bus to run)

    1. NMIS and opCharts data are synced from all poller/mirrors to the Main Primary using Message Bus. In replication mode, if the Main Primary were to go down the Secondary Primary will retain the NMIS and opCharts data.

  2. opHA-MB for opEvents (This license is an add-on for opEvents).

    1. With this add-on opEvents will use MessageBus to sync opEvents data from each poller/mirror to the Main Primary and in replication mode opEvents data is synced to the Secondary Primary. In replication mode, If the Main Primary were to go down the Secondary Primary will retain the opEvents data.

       

  3. You need to add your license to the opLicensing app as below on the main-primary and second-primary servers

6. MongoDB Setup (Main Primary Only)

The following steps should be performed only on the Main Primary MongoDB instance.

6.1 Initialize MongoDB Replica Set

Connect to MongoDB using the mongosh command and configure the replica set:

Run the following command

Add the main-primary and secondary-primary to the below command and run it

6.2 Set Default Write Concern

Run the following command to set the default write concern:

6.3 Add Arbiter

Run the following command to add an arbiter to the replica set:

6.4 Restart mongod on the Main Primary and Second Primary

Run the following command on the Main Primary, Secondary Primary, and Arbiter servers ONLY:

7. Starting Services

7.1 Start NATS

Start the NATS service on the Main Primary, Secondary Primary, and Arbiter servers ONLY:

7.2 Restart mongod on Pollers and Mirrors only

After configuration changes, restart mongod on all Mirrors and Pollers servers ONLY:

7.3 Restart services on all servers

After configuration changes have been made, you will need to restart the relevant FirstWave module daemons applicable to your server.

For example if you have NMIS9, opCharts, opEvents and opHA 5 installed you would execute as follows:

7.4 Start the Poller and Mirrors

Execute the following command on the poller and mirror servers.

8. Final Steps

  1. Accept EULAs: Make sure when you login to each server to confirm that all End User License Agreements (EULAs) are accepted.