Switching Master Slave

Test Case 1: Remove Master as it went down for some hardware reason and make Slave a primary machine so that users can still use Bahmni.

Result: Partial Success

Local setup: Machine A as Master and Machine B as Slave with all components except for lab and PACS and the installation had failed on pgbackrest.

Installer version: 0.92-142

image

Once the installation is complete and tested for database replication, server A was shut down say it has a hardware issue and needs to be removed from network.

image

Local file on B was modified based on the steps mentioned here and started install on B

bahmni -i local install 

failed on

2019-10-27 20:48:07,646 p=26888 u=root |  fatal: [192.168.1.49]: FAILED! => {"msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host's fingerprint to your known_hosts file to manage this host."}

So key was generated on B using

ssh root@ip

The rerun of installation on B but failed again on

TASK [bahmni-base : Fail if timezone is not provided] 
**************************
task path: /opt/bahmni-installer/bahmni-playbooks/roles/bahmni-base/tasks/main.yml:22
fatal: [192.168.1.49]: FAILED! => {"changed": false, "msg": "Please specify timezone to be set to the server by adding value for key 'timezone' in /etc/bahmni-installer/setup.yml. Example, timezone: Asia/Kolkata. Take a look at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones for available timezones "}

This is due to missing setup.yml from B as it was never created on B as a part of original installation. Created the appropriate setup.yml on B and rerun the installation. The installation run smoothly except halted towards the end while installing pgbackrest

`2019-10-29 00:46:53,918 p=15439 u=root |  TASK [pgbackrest-install : Creating postgres stanza] ***************************
ERROR: [132]: ERROR:  recovery is in progress\n                                           
HINT:  WAL control functions cannot be executed during recovery.`

which needs further investigation

Logged on to Bahmni from B and could create patient.

Test is partially successful as pgbackrest failed

Test Case 2: After resolving the hardware issue with A putting it back on network as slave Environment: Same as mentioned above

Since the A had bahmni installed, stopped all bahmni related services on A. Then put it on network, ensured that the local file on B indicates A as slave and run command from B

bahmni -i local install

Install was smooth but again stopped at pgbackrest showing similar error as above.

Make A as slave by running this command on B

bahmni -i local setup-mysql-replication
bahmni -i local setup-postgresql-replication

image

End result: The client has both machines with switched master slave mode.