Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

  1. Go to Master DB box.

...

  1. sudo su root.

...

  1. cd /packages/build/bahmni-environment/mysql-replication/v5.6

...

  1. Update replication.properties with the master and slave host ip address.

      ...

        1. alternatively, add aliases to /etc/hosts file

      ...

        1. Code Block
          {{slave_db_ip}}

      ...

        1.  bahmni-passive-db

      ...

      1. from bahmni-environment, run the "master.sh" script

      ...

      1.  Note down the log pos and log file.

      ...

      1. Login to mysql and check the master status

        Code Block
        show master status;
      2. ...

       

      Steps to configure Slave.1.login to Save

      1. Login to slave db box

      ...

      1. sudo su root

      ...

      1. cd to /packages/build/bahmni-environment/mysql-replication/v5.6

      ...

      1. Update replication.properties with the master and slave host ip address.

          ...

            1. alternatively, add aliases to /etc/hosts file

          ...

            1. Code Block
              {{master_db_ip}} bahmni-db

          ...

          1. Update the log file and log pos values noted down on master on replication.properties

          ...

          1. Copy the dump file from master onto slave

              ...

                1. /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

              ...

                1. (bahmni v0.76)
                2. scp bdshr@master-db-ip:/packages/build/bahmni-environment/mysql-replication/v5.6

              ...

                1. /

              ...

                1. mysql_master_dump.

              ...

                1. db

              ...

                1. /tmp

              Delete the dump on CI box.

              rm /tmp/mysql_master_dump.db

              ...

              1. run script "slave.sh"

              ...

              1. login to mysql and check the slave status
                1. Code Block
                  show slave status;