DGHS Project

Looking for help?
< All Topics
Print

Steps to set up Mysql replication

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:

  1. Go to Master DB box.
  2. sudo su root.
  3. cd /packages/build/bahmni-environment/mysql-replication/v5.6
  4. Update replication.properties with the master and slave host ip address.
    1. alternatively, add aliases to /etc/hosts file
      {{slave_db_ip}} bahmni-passive-db
  5. from bahmni-environment, run the “master.sh” script
  6.  Note down the log pos and log file.
  7. Login to mysql and check the master status
    show master status;

 

Steps to configure Slave

  1. Login to slave db box
  2. sudo su root
  3. cd to /packages/build/bahmni-environment/mysql-replication/v5.6
  4. Update replication.properties with the master and slave host ip address.
    1. alternatively, add aliases to /etc/hosts file
      {{master_db_ip}} bahmni-db
  5. Update the log file and log pos values noted down on master on replication.properties
  6. Copy the dump file from master onto slave
    1. /packages/build/bahmni-environment/mysql-replication/v5.6/mysql_master_dump.db (bahmni v0.76)
    2. scp bdshr@master-db-ip:/packages/build/bahmni-environment/mysql-replication/v5.6/mysql_master_dump.db /tmp
  7. run script “slave.sh”
  8. login to mysql and check the slave status
    1. show slave status;

Table of Contents