Non-Replication Setup and Configuration Guide
opHA introduces the concept of a Primary & multiple Poller servers and a message bus:
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 recieves update from the database if there is any. This change stream data is pushed onto the message bus.
Here are terms used in this project together with their meanings.
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. Pollers and mirrors discovered by the Main-Primary
b. Server names set
c. Mongo 6 installed
In this setup guide we are using example server/host names so you will have to use the names that you have set for your own configuration.
Main-Primary Server : opha-dev1.opmantek.net
Poller1 Server opha-dev2.opmantek.net
Mirror1 Server opha-dev3.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
2. NATS Setup
This configuration should be applied to the Main-Primary server ONLY.
Edit Configuration: Update the
/etc/nats-server.conf
file with the following settings:Remove or comment out the cluster section
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
Backup Configuration: Make a backup copy of the
opCommon.json
file before making any changes.Add NATS Server Configuration: Ensure the following configuration is included in
opCommon.json
on all servers. In the below example we have added the main-primary in the nats_server string int the “database“ json object"nats_server": "opha-dev1.opmantek.net:4222"
IMPORTANT
Delete the following line
"db_mongo_cluster": [],
5. MongoDB Setup (Main-Primary Only)
The following steps should be performed only on the Main-Primary MongoDB instance.
5.1 Initialize MongoDB Replica Set
Connect to MongoDB using the mongosh
command and configure the replica set:
Run the following command
mongosh --username opUserRW --password op42flow42 admin
Run the following command
rs.initiate()
Restart mongod
systemctl restart mongod
6. Starting Services
6.1 Start NATS
Start the NATS service on the Main-Primary server ONLY:
systemctl start nats-server
6.2 Restart mongod on Pollers and Mirrors only
After configuration changes, restart mongod on all Mirrors and Pollers servers ONLY :
systemctl restart mongod
6.3 Restart services on all servers
After configuration changes, restart the services on all the servers :
systemctl restart nmis9d opchartsd opeventsd omkd ophad
4.2 Update License
Currently there are 2 available licenses and messagebus will not run without a license.
opHA-MB for NMIS & opCharts (This license is required for messagebus to run)
opHA-MB for opEvents (This license is an add-on for opEvents)
6.3 Restart ophad on the main-primary
systemctl restart ophad
6.4 Start the Poller and Mirrors
Execute the following command on the poller and mirror servers.
cd /usr/local/omk/bin ./ophad cmd producer start
7. Final Steps
Accept EULAs: Make sure when you login to each server to confirm that all End User License Agreements (EULAs) are accepted.