Krish cc66d5aaa5 Single node setup (#1418)
* Add more tools to the toolbox container

* Add mongodb monitoring agent
* Add a bigchaindb/mongodb-monitoring-agent container that includes the
monitoring agent.
* It makes use of an api key provided by MongoDB Cloud Manager. This is
included in the configuration/config-map.yaml file.

* Changes to mongodb StatefulSet configuration
Changes to bump up mongodb version to v3.4.3.
Add configuration settings for mongodb instance name in ConfigMap.
Split the mongodb service to a new configuration file.

* Modify bigchaindb deployment config
* Bugfix to remove keyring field for the first node.
* Split the mongodb service to a new configuration file.

* Add mongodb backup agent
* Add a bigchaindb/mongodb-backup-agent container that includes the
backup agent.
* It makes use of an api key provided by MongoDB Cloud Manager. This is
included in the configuration/config-map.yaml file.

* Changes to nginx deployment config
* Allow 'all' by default for now. This is included in the
configuration/config-map.yaml file.
* Dynamically resolve DNS addresses of our backend services; cache DNS
resolution for 20s.
* Configure DNS based on user provided resolver. This helps in user
deciding to provide 8.8.8.8 or a custom DNS for name resolution. For k8s
deployments, we use the hardcoded k8s DNS IP of 10.0.0.10.

* Changes to nginx-3scale deployment config
* Use the common ConfigMap in configuration/config-map.yaml file.

* Removing prefix `v` from the docker tag for mongodb-monitoring-agent and mongodb containers

* Bumping up version for nginx-3scale container

* Add small helper scripts for docker build and push of mongodb monitoring
and backup agents

* Documentation for setting up the first node with monitoring and backup
agents
2017-04-21 14:41:12 +02:00
..
2017-04-21 14:41:12 +02:00
2017-04-21 14:41:12 +02:00

Custom MongoDB container for BigchainDB Backend

Need

  • MongoDB needs the hostname provided in the rs.initiate() command to be resolvable through the hosts file locally.
  • In the future, with the introduction of TLS for inter-cluster MongoDB communications, we will need a way to specify detailed configuration.
  • We also need a way to overwrite certain parameters to suit our use case.

Step 1: Build the Latest Container

make from the root of this project.

Step 2: Run the Container

docker run \
--name=mdb1 \
--publish=<mongo port number for external connections>:<corresponding host port> \
--rm=true \
bigchaindb/mongodb \
--replica-set-name <replica set name> \
--fqdn <fully qualified domain name of this instance> \
--port <mongod port number for external connections>

Step 3: Initialize the Replica Set

Login to one of the MongoDB containers, say mdb1:

docker exec -it mdb1 bash

Start the mongo shell:

mongo --port 27017

Run the rs.initiate() command:

rs.initiate({ 
  _id : "<replica-set-name", members: [
  { 
    _id : 0,
    host : "<fqdn of this instance>:<port number>"
  } ]
})

For example:

rs.initiate({ _id : "test-repl-set", members: [ { _id : 0, host :
"mdb-instance-0.westeurope.cloudapp.azure.com:27017" } ] })

You should also see changes in the mongo shell prompt from > to test-repl-set:OTHER> to test-repl-set:SECONDARY> to finally test-repl-set:PRIMARY>. If this instance is not the primary, you can use the rs.status() command to find out who is the primary.

Step 4: Add members to the Replica Set

We can only add members to a replica set from the PRIMARY instance. Login to the PRIMARY and open a mongo shell.

Run the rs.add() command with the ip and port number of the other containers/instances:

rs.add("<fqdn>:<port>")

For example:

Add mdb2 to replica set from mdb1:

rs.add("bdb-cluster-1.northeurope.cloudapp.azure.com:27017")

Add mdb3 to replica set from mdb1:

rs.add("bdb-cluster-2.northeurope.cloudapp.azure.com:27017")