Anaconda Enterprise Notebooks Version 4.1.x - 4.2.x
Anaconda Enterprise Notebooks uses MongoDB as it's database to stores information on users, projects, gateways, and compute nodes. In an Enterprise environment it may be beneficial to setup MongoDB for automatic failover and redundancy.This can be accomplished by settings up a MongoDB Replica Set. Details on Replica Sets can be found in the MongoDB Documentation. To set this up it is necessary to have at least 3 MongoDB installations. Steps to install MongoDB for AEN can be found here.
Once a Replica Set is up it will automatically sync data to all MongoDB instances that are part of the Replica Set. This means a replica set can be made after AEN has already been setup or at the beginning.
Configuring the replica set:
On Each node you will need to edit the /etc/mongod.conf file.
Comment out the bind_ip:
#bind_ip=127.0.0.1
Uncomment the replSet line and set the name you wish to give the replica set. This should be the same in all configuration files.
replSet=<Replica Set Name>
The basic configuration is as follows. Each member should be given an "_id" and "host" which is the URL and port number(27017 by default) of each MongoDB instance.
mongo
conf = { "_id" : "<Replica Set Name>", "members" : [
{"_id" : 0, "host" : "URL:Port"},
{"_id" : 1, "host" : "URL:Port"},
{"_id" : 2, "host" : "URL:Port"}
]}
rs.initiate(conf)
Now you can check the status. It should list one PRIMARY and two SECONDARY instances. The PRIMARY is the one that AEN will connect to. If the PRIMARY fails MongoDB will automatically elect a new PRIMARY and AEN operations can continue.
rs.status()
Configure AEN to use the ReplicaSet:
Edit the /opt/wakari/wakari-server/etc/wk-server-config.json file and add the following entry with your MongoDB URLs.
{ EXISTING_CONFIGURATION,
"MONGO_URL" : "mongodb://URL1:Port,URL2:Port,URL3:Port/?replicaset=<Replica Set Name>",
}
Next you can restart the wakari-server process and your installation should be running.
sudo service wakari-server restart