opHA-MB 5.1.0 Upgrade (Non-Replication)
Non-Replication Setup and Configuration Guide
- 1 Non-Replication Setup and Configuration Guide
- 2 Introduction
- 3 Software Installation
- 3.1 1. Upgrade to opHA-5.1.0 with no opHA
- 3.1.1 1.1 Prerequisites
- 3.1.2 1.2 Download Software
- 3.1.3 1.3 Install Software
- 3.1.4 1.4 Install Message Bus Software
- 3.1.5 1.5 NATS Setup
- 3.1.6 1.6 MongoDB Setup (Main Primary Only)
- 3.1.6.1 Initialize MongoDB Replica Set
- 3.1.7 1.7 Common opCommon.json Configuration for All Servers
- 3.1.8 1.8 Starting Services
- 3.1.9 1.9 Discover the Peers
- 3.1.10 1.10 Synchronize the Primary collections with Poller
- 3.1.11 1.11 Restart opHA service on the Main Primary
- 3.1.12 1.12 Start the Poller and Mirrors
- 3.1.13 1.13 Final Steps
- 3.2 2. Upgrade to opHA-5.1.0 from opHA 4.X
- 3.2.1 2.1 Prerequisites
- 3.2.2 2.2 Download Software
- 3.2.3 2.3 Install Software
- 3.2.4 2.4 Install Message Bus Software
- 3.2.5 2.5 NATS Setup
- 3.2.6 2.6 MongoDB Setup (Main Primary Only)
- 3.2.7 2.7 Initialize MongoDB Replica Set
- 3.2.8 2.8 Common Configuration for All Servers
- 3.2.9 2.9 Starting Services
- 3.2.10 2.10 Synchronize the Primary collections with Poller
- 3.2.11 2.11 Start the Poller and Mirrors
- 3.2.12 2.12 Final Steps
- 3.1 1. Upgrade to opHA-5.1.0 with no opHA
Introduction
opHA-MB 5.X 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 receives updates from the database when there are any. This change stream data is pushed onto the Message Bus.
For the terms used in this project together with their meanings, see https://docs.community.firstwave.com/wiki/spaces/opHA/pages/edit-v2/3164408853#Terminology.
Software Installation
Upgrade to opHA-MB 5.1.0 can be done from infrastructure
New to opHA/opHA-MB
Running opHA 4.X
1. Upgrade to opHA-5.1.0 with no opHA
1.1 Prerequisites
IMPORTANT: All the servers should be setup with the following
a. Server names set
b. MongoDB 6 installed
c. The role of the vm on which opHA-5.1.0 needs to be installed should be known and appropriately set (opha_role) in opCommon.json
d. opHA-MB licenses to be installed.
e. Time should be properly synchronised (using chrony) on all the vms Primaries and Peers.
We will be using the below example host names throughout this guide.
You would replace with your own where applicable.
Main Primary: opha-primary1.opmantek.net
Poller1 Server: opha-poller1.opmantek.net
1.1.1 Editing the Role of the instance in opCommon.json
The default value of opha_role in opCommon.json is Standalone
shankarn@opha-dev7:~$ grep opha_role /usr/local/omk/conf/opCommon.json
"opha_role" : "Standalone",Edit /usr/local/omk/conf/opCommon.json to change in to one of
“Main Primary”
“Poller”
“Mirror”
1.1.2 Installing opHA-MB license
Install the opHA-MB for NMIS & opCharts license on all the servers.
To obtain a license please contact FirstWave Sales.
Currently there are 2 available licenses and Message Bus will not run without a license.
opHA-MB for NMIS & opCharts (This license is required for Message Bus to run).
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.
opHA-MB for opEvents (This license is an add-on for opEvents).
With this add-on opEvents will use Message Bus 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.
You need to enter a License Key in the Modules → opLicensing Enter License key as below on all the servers .
1.2 Download Software
Download the opHA 5 software onto each server.
1.3 Install Software
Run the installation commands on each server in the opHA cluster.
All the following setup commands in this setup should be run as the root user
sudo sh ./<executable>e.g
sudo sh ./opHA-MB-x86_64-5.1.0.run1.4 Install Message Bus Software
The Message Bus software (NATS) has to be installed and configured.
For this scenario, we do not need a MongoDB Arbiter, so use -y to answer yes to the two questions.
Ensure you have added both opHA-MB for NMIS & opCharts and opHA-MB for opEvents licenses are added under opLicensing
1.5 NATS Setup
This configuration should be applied to the Main Primary server ONLY.
Edit Configuration: Update the
/etc/nats-server.conffile with the following settings:Change the server_name to the name of your Main Primary server.
Remove or comment out the
clustersection, so that this remains:
server_name: "opha-primary1.opmantek.net" #The local server
http_port: 8222
listen: 4222
jetstream: enabled
#tls {
# cert_file: "<path>"
# key_file: "<path>"
# #ca_file: "<path>"
# verify: true
#}
log_file: "/var/log/nats-server.log"
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
}
1.6 MongoDB Setup (Main Primary Only)
The following steps should be performed on all the servers. only on the Main Primary MongoDB instance.
Initialize MongoDB Replica Set
Connect to MongoDB using the mongosh command:
Run the following command
mongosh --username opUserRW --password op42flow42 adminThen run the following commands, to initiate a MongoDB Replica Set for streaming database changes.
Note:- On Poller and Mirror, if Mongo has automatically initiated and you see ‘rs0 [direct: primary] admin>’ at the Mongo shell prompt, you can skip the steps below and exit from Mongo Shell.
rs.initiate()
exitRestart mongod
sudo systemctl restart mongod1.7 Common opCommon.json Configuration for All Servers
1.7.1 Update /usr/local/omk/conf/opCommon.json
Backup Configuration: Make a backup copy of the
opCommon.jsonfile before making any changes.Add NATS Server Configuration: Ensure the following configuration is included in
opCommon.jsonon all servers. In the below example we have added the Main Primary FQDN and port to be utilized in the nats_server attribute, you can find this in thedatabasesection."nats_server": "opha-primary1.opmantek.net"IMPORTANT
Delete the following line from the
opCommon.jsonfile."db_mongo_cluster": [],
1.8 Starting Services
1.8.1 Start NATS (on Main Primary Only)
Start the NATS service on the Main Primary server ONLY:
sudo systemctl start nats-server1.8.2 Restart FirstWave daemons 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:
sudo systemctl restart nmis9d opchartsd opeventsd omkd1.9 Discover the Peers
Click on Peers in opHA-MB portal on the Main Primary (http://<fqdn of Main Primary>/en/omk/opHA/peers)
Proceed to next step after discovering all the Peers.
1.10 Synchronize the Primary collections with Poller
For all the opHA Peers, go to opHA Peers page click on “Sync all nodes” followed by “Pull Peer Data”
1.11 Restart opHA service on the Main Primary
sudo systemctl restart ophad1.12 Start the Poller and Mirrors
Execute the following command on the poller and mirror servers.
sudo /usr/local/omk/bin/ophad cmd producer start1.13 Final Steps
Accept EULAs: Make sure when you login to each server to confirm that all End User License Agreements (EULAs) are accepted.
2. Upgrade to opHA-5.1.0 from opHA 4.X
2.1 Prerequisites
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. On the Main Primary, go to the Peers screen, and for each Peer, click on the Sync all nodes button and Pull Peer Data button to ensure latest data is on the Main Primary.
d. Server names set
e. MongoDB 6 installed
We will be using the below example host names throughout this guide.
You would replace with your own where applicable.
Main Primary: opha-primary1.opmantek.net
Poller1 Server: opha-poller1.opmantek.net
2.1.1 Editing the Role of the instance in opCommon.json
The default value of opha_role in opCommon.json is Standalone
shankarn@opha-dev7:~$ grep opha_role /usr/local/omk/conf/opCommon.json
"opha_role" : "Standalone",Edit /usr/local/omk/conf/opCommon.json to change in to one of
“Main Primary”
“Primary”
“Poller”
“Mirror”
2.1.2 Installing opHA-MB license
Install the opHA-MB for NMIS & opCharts license on the Main Primary server only.
To obtain a license please contact FirstWave Sales.
Currently there are 2 available licenses and Message Bus will not run without a license.
opHA-MB for NMIS & opCharts (This license is required for Message Bus to run).
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.
opHA-MB for opEvents (This license is an add-on for opEvents).
With this add-on opEvents will use Message Bus 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.
You need to enter a License Key in the Modules → opLicensing as below on the Main Primary.
2.2 Download Software
Download the opHA-MB 5 software onto each server.
2.3 Install Software
Run the installation commands on each server in the opHA cluster.
All the following setup commands in this setup should be run as the root user
sudo sh ./<executable>e.g
sudo sh ./opHA-MB-Linux-x86_64-5.1.0.run2.4 Install Message Bus Software
The Message Bus software (NATS) has to be installed and configured.
For this scenario, we do not need a MongoDB Arbiter, so use -y to answer yes to the two questions.
2.5 NATS Setup
This configuration should be applied to the Main Primary server ONLY.
Edit Configuration: Update the
/etc/nats-server.conffile with the following settings:Change the server_name to the name of your Main Primary server.
Remove or comment out the
clustersection, so that this remains:
server_name: "opha-primary1.opmantek.net" #The local server
http_port: 8222
listen: 4222
jetstream: enabled
#tls {
# cert_file: "<path>"
# key_file: "<path>"
# #ca_file: "<path>"
# verify: true
#}
log_file: "/var/log/nats-server.log"
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
}
2.6 MongoDB Setup (Main Primary Only)
The following steps should be performed only on the Main Primary MongoDB instance.
2.7 Initialize MongoDB Replica Set
Connect to MongoDB using the mongosh command:
Run the following command
mongosh --username opUserRW --password op42flow42 adminThen run the following commands, to initiate a MongoDB Replica Set for streaming database changes.
rs.initiate()
exitRestart mongod
systemctl restart mongod2.8 Common Configuration for All Servers
2.8.1 Update /usr/local/omk/conf/opCommon.json
Backup Configuration: Make a backup copy of the
opCommon.jsonfile before making any changes.Add NATS Server Configuration: Ensure the following configuration is included in
opCommon.jsonon all servers. In the below example we have added the Main Primary FQDN and port to be utilized in the nats_server attribute, you can find this in thedatabasesection."nats_server": "opha-primary1.opmantek.net"IMPORTANT
Delete the following line from the
opCommon.jsonfile."db_mongo_cluster": [],
2.9 Starting Services
2.9.1 Start NATS (on Main Primary Only)
Start the NATS service on the Main Primary server ONLY:
sudo systemctl start nats-server2.9.2 Restart mongod on Pollers and Mirrors only
After configuration changes, restart mongod on all Poller and Mirror servers ONLY:
sudo systemctl restart mongod2.9.3 Restart FirstWave daemons 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:
sudo systemctl restart nmis9d opchartsd opeventsd omkd ophad
Note: after you restart the daemons, opHA MB will not be licensed on the Main Primary, so the ophad daemon will show as an Error:
Proceed to the next step.
2.9.4 Restart opHA service on the Main Primary
sudo systemctl restart ophad2.10 Synchronize the Primary collections with Poller
For all the opHA Peers, go to opHA Peers page click on “Sync all nodes” followed by “Pull Peer Data”. Please refer to https://docs.community.firstwave.com/wiki/spaces/opHA/pages/3272605706/opHA-MB+5.0+User+Guide#Scenario-1-%3A-Using-opHA4-‘Pull’-on-Primary-to-synchronize-nmisng-collections for more details.
2.11 Start the Poller and Mirrors
Execute the following command on the poller and mirror servers.
sudo /usr/local/omk/bin/ophad cmd producer startPlease refer to https://docs.community.firstwave.com/wiki/spaces/opHA/pages/3272605706/opHA-MB+5.0+User+Guide#Scenario-1-%3A-ophad-doesn%E2%80%99t-come-up
2.12 Final Steps
Accept EULAs: Make sure when you login to each server to confirm that all End User License Agreements (EULAs) are accepted.
Ensure that all servers are configured to use the same timezone by using chronyc tracking. Steps to sync time :
sudo timedatectl set-timezone Australia/Sydney
sudo apt update
sudo apt install chrony -y
chronyc tracking