CHW instance is a Bahmni reference application databases (technically openmrs database) are often deployed in replicated set up.mysql
For this, MySql replication has to be set up.
BahmniAlthough, bahmni-environment has a task script to set up replication
This step needs , some manual intervention and is required (e.g. not automated in our CI set up).
Steps to Configure master:1.
- Go to Master DB box.
...
- sudo su root.
...
- cd /packages/build/bahmni-environment/mysql-replication/v5.6
...
- Update replication.properties with the master and slave host ip address.
...
alternatively, add aliases to /etc/hosts file
...
Code Block {{slave_db_ip}}
...
bahmni-passive-db
...
- from bahmni-environment, run the "master.sh" script
...
- Note down the log pos and log file.
...
Login to mysql and check the master status
Code Block show master status;
- ...
Steps to configure Slave.1.login to Save
- Login to slave db box
...
- sudo su root
...
- cd to /packages/build/bahmni-environment/mysql-replication/v5.6
...
- Update replication.properties with the master and slave host ip address.
...
alternatively, add aliases to /etc/hosts file
...
Code Block {{master_db_ip}} bahmni-db
...
- Update the log file and log pos values noted down on master on replication.properties
...
- Copy the dump file from master onto slave
...
- /packages/build/bahmni-environment/mysql-replication/v5.6/mysql_master_dump.db
...
On prod, copy the dump from master to CI and from CI to slave
On CI box, copy from master
...
- (bahmni v0.76)
- scp bdshr@master-db-ip:/packages/build/bahmni-environment/mysql-replication/v5.6
...
- /
...
- mysql_master_dump.
...
- db
...
- /tmp
Delete the dump on CI box.
rm /tmp/mysql_master_dump.db
...
- run script "slave.sh"
...
- login to mysql and check the slave status
Code Block show slave status;