Set Up the Database for HA
The database layer Moogsoft Onprem for HA uses the Percona XtraDB Cluster mechanism.
HA architecture
In our distributed HA installation, the database components are installed on servers DB 1, DB 2, and DB 3:
Refer to the Distributed HA system Firewall for more information on connectivity within a fully distributed HA architecture.
Build a Percona cluster
The sections below detail how to build a Percona XtraDB cluster.
Percona ports
Before you begin, make sure the ports which Percona requires are available. By default, Percona XtraDB Cluster nodes use the following ports:
Port Number | Use |
---|---|
3306 | MySQL client connections and SST (State Snapshot Transfer) via mysqldump |
4444 | SST via Percona XtraBackup |
4567 | Write-set replication traffic (over TCP) and multicast replication (over TCP and UDP) |
4568 | IST (Incremental State Transfer) |
Install Moogsoft Onprem components on DB 1, 2 and 3
On servers DB 1, 2 and 3, install the following Moogsoft Onprem components:
VERSION=9.1.0; yum -y install moogsoft-utils-${VERSION} moogsoft-db-${VERSION};
Edit the ~/.bashrc
file to contain the following lines:
export MOOGSOFT_HOME=/usr/share/moogsoft export APPSERVER_HOME=/usr/share/apache-tomcat export JAVA_HOME=/usr/java/latest export PATH=$PATH:$MOOGSOFT_HOME/bin:$MOOGSOFT_HOME/bin/utils
Source the .bashrc
file:
source ~/.bashrc
Set up Percona on DB 1
On DB 1, run install_percona_nodes.sh
to install, configure and start Percona Cluster node 1. Substitute the IP addresses of your servers and choose the password for the sstuser. Press <Enter> at the password prompt during initialization.
install_percona_nodes.sh -p -d -i <DB 1 server IP address>,<DB 2 server IP address>,<DB 3 server IP address>
Moogsoft advises that you provide the IP addresses instead of hostnames for servers running the Percona Cluster in order to reduce network latency. The “sstuser“, in the command above, is the user that will be used by the Percona nodes to communicate with each other. The script performs the following tasks:
Disables SELinux and sets the
vm.swappiness
property to 1.Installs the Percona Yum repository.
Installs the Percona compatibility package.
Installs Percona XtraDB cluster.
Installs the Extended Internet Service Daemon (xinetd).
Creates a
my.cnf
configuration file based on the server's hardware.Configures a
mysqlchk
service on port 9198 and restarts the xinetd service.Starts the first Percona node in bootstrap mode.
Reconfigures
my.cnf
to ensure the node will restart in non-bootstrap mode.
Initialize the Moogsoft Onprem database
On DB 1, run the following commands to create the Moogsoft Onprem databases (moogdb
, moog_reference
, historic_moogdb
, moog_intdb
), and populate them with the required schema:
$MOOGSOFT_HOME/bin/utils/moog_init_db.sh -qIu root --accept-eula <<-EOF EOF
Note
You do not need to run this command on any of the other nodes. The new schema is replicated automatically around the cluster.
Set up Percona on DB 2
On DB 2, run install_percona_nodes.sh
. Substitute the IP addresses of your servers and use the same sstuser password as DB 1. The script will perform the same actions, only this time starting the second Percona node to join the first node as a cluster.
install_percona_nodes.sh -d -i <DB 1 server IP address>,<DB 2 server IP address>,<DB 3 server IP address>
Set up Percona on DB 3
On DB 3, run install_percona_nodes.sh
as you did for DB 1 and DB 2. Substitute the IP addresses of your servers and use the same sstuser password as DB 1. The script will perform the same actions, only this time starting the third Percona node to join the first and second nodes as a cluster.
install_percona_nodes.sh -d -i <DB 1 server IP address>,<DB 2 server IP address>,<DB 3 server IP address>
Verify Percona cluster status
To verify the replication status of each node, run the following commands from a remote server:
curl http://<DB 1 server IP address/hostname>:9198 curl http://<DB 2 server IP address/hostname>:9198 curl http://<DB 3 server IP address/hostname>:9198
If successful, you see the following message:
Percona XtraDB Cluster Node is synced.