Bahmni reference application databases (technically openmrs database) are often deployed in replicated set up.
For this, MySql replication has to be set up.
Although, bahmni-environment has a script to set up replication, some manual intervention is required (e.g. not automated in our CI set up).
Steps to Configure master:
- 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
{{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
- ...
Steps to configure Slave
- 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
{{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 (bahmni v0.76)
- scp bdshr@master-db-ip:/packages/build/bahmni-environment/mysql-replication/v5.6/mysql_master_dump.db /tmp
- run script "slave.sh"
- login to mysql and check the slave status