Installing Bahmni on separate servers

Tags: #<Tag:0x00007fe2e7ee3f28>

Hello Community

I have a Bahmni Dev installation on one server for both App and DB, but for Production the requirement is to separate the App and the DB. How do I go about this because Bahmni installation is automated through several scripts.

You can change your inventory file /etc/bahmni-installer/local for set-up application & database in multiple server. Here is the Documentation Link Please see this. Sample inventory file Link . You can put other server ip address in the inventory file & try bahmni install command.

Thanks @rakib.hasan for pointing me to the article. I just want to confirm that everything is in order before I proceed with the installtion. My 2 servers are as follows

  • Application:
  • Database:

So these are the steps I have done so far (I want all databases installed on DB Server, and all other components on App Server)

  1. Installed Bahmni Installer using command > yum install https: //dl /bahmni/rpm/rpms/bahmni-installer-0 .92-142.noarch.rpm #version 0.92

  2. Edited the inventory file at /opt/bahmni-installer/bahmni-playbooks/local and this is how my file looks like

@rakib.hasan any luck? Did you check my inventory file?

Hello @tapologo, In the inventory file you should add the host ip of your application & db server with ansible_user & ansible_private_key_file like link.

You can see @angshuonline reply Link

I can describe in short about ssh access & ansible in the bellow:

We can use-

  • Application server(,
  • database server( &
  • another control machine.

In Control Machine we will install bahmni installer & edited the inventory file like above mentioned pestbin link. The requirement of ansible’s remote access is : sudo access to application & database server. We can do it by generating ssh-keygen command & you can study from here.

In each server we need to generate ssh-key by executing ssh-keygen & copy authorized key to other servers by executing ssh-copy user@server_ip. After this, We need to install ansible in control machine and add the bellow lines in /etc/ansible/hosts file: ansible_user=root ansible_private_key_file=/root/.ssh/id_rsa ansible_user=root ansible_private_key_file=/root/.ssh/id_rsa

And we can test ansible access by executing ansible all -a “/bin/echo hello” and get the bellow result if all configuration is correctly done. | SUCCESS | rc=0 >>
hello | SUCCESS | rc=0 >>

after that if you need edit bahmni setup file please edit it & start bahmni install by executing bahmni -i local install. I have tested in bahmni 0.91. So please do it in bahmni 0.91 first & then 0.92.

@rakib.hasan When we followed the same process for master slave set up, it installed Bahmni on master and databases on both (master and slave) but the databases do not sync with each other ie when a patient is created from Bahmni it gets stored only in master db but not in slave. Any pointers to isolate the reason? And of course the subsequent follow up to resolve our issue. Tested on Bahmni 0.91.

Hello @akshaybirajdar, I think, you may be miss the replica setup command:

  • To setup mysql replication, following command needs to be executed:

    bahmni -i <inventory_file_name> setup-mysql-replication
  • To setup postgres replication, following command needs to be executed:

     bahmni -i <inventory_file_name> setup-postgres-replication

For details please see the link

I have tested the master-slave setup in bahmni 0.91 & successfully sync with slave on any update on master db. I made my inventory file like this file.

@rakib.hasan Thank you, we will try these steps and will try same with Bahmni 0.92.

Thanks @rakib.hasan for your detailed instructions. I followed everything but still struggling with installation. I managed to create the inventory file and it’s working properly, however I noticed that on the remote DB server, mysql gets installed successfully but the openmrs schema is not created. See below list of my current databases

mysql> show databases;
| Database             |
| information_schema   |
| mysql                |
| performance_schema   |
| sys                  |
4 rows in set (0.00 sec)

The other thing, after running the installer, when I check I only see that the Bahmni Installer got installed, everything else did not

# yum list installed | grep bahmni
bahmni-installer.noarch            0.92-142      @/bahmni-installer-0.92-142.noarch

This is the message I get after running bahmni -i inventory install

fatal: []: FAILED! => {"changed": false, "module_stderr": "Shared connection to closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/tmp/ansible_shtYTU/\", line 218, in <module>\r\n    from ansible.module_utils.basic import AnsibleModule\r\nzlib.error: Error -2 while preparing to decompress data: inconsistent stream state\r\n", "msg": "MODULE FAILURE", "rc": 0}
        to retry, use: --limit @/opt/bahmni-installer/bahmni-playbooks/all.retry

PLAY RECAP ******************************************************************************************************************************************************************************                  : ok=62   changed=25   unreachable=0    failed=1
localhost                  : ok=45   changed=12   unreachable=0    failed=0

Traceback (most recent call last):
  File "/bin/bahmni", line 11, in <module>
    load_entry_point('bahmni==0.1', 'console_scripts', 'bahmni')()
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/Click-7.0-py2.7.egg/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "build/bdist.linux-x86_64/egg/", line 79, in install
  File "/usr/lib64/python2.7/", line 542, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'ansible-playbook -i /etc/bahmni-installer/inventory all.yml -vv  --extra-vars '@/etc/bahmni-installer/rpm_versions.yml' --extra-vars '@/etc/bahmni-backrest.conf' --extra-vars '@/etc/bahmni-installer/setup.yml'' returned non-zero exit status 2