This cookbook helps to create a Clustered MongoDB scenario with Replication and Sharding. 4 VM instances are needed for it to work. These recipes are to be executed only once using knife solo.
TODO:
After initialising 4 virtual instances of CentOS 7 on any VM run 'knife solo prepare' from your workstaion on all 4 instances, after that note down the IP adresses of the instances and update them in attributes/default.rb.
Then proceed with the following tasks in order.
- Update the runlist on all the generated JSON files under the nodes diretory for each corresponding instances.
- Update first instance JSON file with runlist as ["recipe[CDB]","recipe[CDB::pc1]"]
- Update second instance JSON file with runlist as ["recipe[CDB]","recipe[CDB::pc2]"]
- Update third instance JSON file with runlist as ["recipe[CDB]","recipe[CDB::pc3]","recipe[CDB::master_initialize]"]
- Update fourth instance JSON file with runlist as ["recipe[CDB]","recipe[CDB::pc4]"]
- Cook recipes in following order:
- Instance 1
- Instance 2
- Instance 3
- Instance 4
The main app communicates with MongoDB through the fourth instance. All mongo operation and commands are to be executed through the fouth instance.