MongoDB Replica Set
The MongoDB Replica Set
kit defines an environment with a 3 node MongoDB replica set and two Cloud CMS environments running against it
The configuration files for this kit can be found in the Gitana SDK
Running
Start the mongo servers first and then initialize the cluster:
docker login --username {docker-username} --password '{docker-password}'
docker-compose up -d mongodb1 mongodb2 mongodb3
Initialize the replic set. only have to do this once since the mongo servers persist their state to ./data/mongodbN (see docker-compose.yml)
mongo localhost:27027 --eval 'rs.initiate( {_id : "cloudcms-replicaset",members: [ { _id: 0, host: "mongodb1:27017" },{ _id: 1, host: "mongodb2:27017" },{ _id: 2, host: "mongodb3:27017" }]})'
Or just run this script from the Gitana SDK:
./init-replicaset.sh
If you don't have the mongo shell client installed locally then open a shell to one of the mongo nodes and run the following command from there. The server you run the command on will probably become the PRIMARY so should probably run it on mongodb1
rs.initiate( {
_id : "cloudcms-replicaset",
members: [
{ _id: 0, host: "mongodb1:27017" },
{ _id: 1, host: "mongodb2:27017" },
{ _id: 2, host: "mongodb3:27017" }
]
})
Confirm the replica set is running. Run this command from the mongo shell client:
rs.conf()
Start the rest of environment 1. wait for it to initialize (~3 minutes)
docker-compose up -d activemq1 elasticsearch1 api1 ui1
Start environment 2
docker-compose up -d activemq2 elasticsearch2 api2 ui2
Login to each environment with user: admin and password: admin
http://localhost:180
http://localhost:280
Now that environment is initialized you can start/restart the complete environment by running:
docker-compose up --build --force-recreate --remove-orphans -d