import mdocker from mdocker import wait_until_up, wait_to_become_primary, MDocker import pymongo from pymongo import MongoClient import collections from timeit import default_timer as timer from pymongo import ReadPreference import time # create an instance of MDocker docker = MDocker() # create new system (image, params, mongo port) deploy = collections.OrderedDict() default_image = "alex/mongodb_1" deploy["mongo_D1"] = (default_image, "mongod --smallfiles --replSet xxx", 27017) deploy["mongo_D2"] = (default_image, "mongod --smallfiles --replSet xxx", 27017) deploy["mongo_CFG"] = (default_image, "mongod --smallfiles", 27017) deploy["mongo_S1"] = (default_image, "mongos --configdb mongo_CFG:27017", 27017) # deploy the system res = docker.deploy(deploy) if res != 1: print("Failed deploying. Aborting") docker.cleanup() sys.exit(2) # initialize it
import mdocker from mdocker import wait_until_up, wait_to_become_primary, MDocker import pymongo from pymongo import MongoClient import collections from timeit import default_timer as timer from pymongo import ReadPreference import time #create an instance of MDocker docker = MDocker() # create new system (image, params, sleep time) deploy = collections.OrderedDict() default_image = "alex/mongodb_26_auth_ent" deploy["mongo_D1"] = (default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --replSet xxx --keyFile /usr/local/bin/keyfile", 27017) deploy["mongo_D2"] = (default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --replSet xxx --keyFile /usr/local/bin/keyfile", 27017) deploy["mongo_CFG1"] = (default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --keyFile /usr/local/bin/keyfile", 27017) deploy["mongo_CFG2"] = (default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --keyFile /usr/local/bin/keyfile", 27017) deploy["mongo_CFG3"] = (default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --keyFile /usr/local/bin/keyfile", 27017) deploy["mongo_S1"] = (default_image, "mongos --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --configdb mongo_CFG1:27017,mongo_CFG2:27017,mongo_CFG3:27017 --keyFile /usr/local/bin/keyfile", 27017) res = docker.deploy(deploy) if res != 1: print("Failed deploying. Aborting") docker.cleanup() sys.exit(2) # initialize it replSetConfig = { "_id" : "xxx",
import mdocker from mdocker import wait_until_up, wait_to_become_primary, MDocker import pymongo from pymongo import MongoClient import collections from timeit import default_timer as timer from pymongo import ReadPreference import time import sys #create an instance of MDocker docker = MDocker() # create new system (image, params, sleep time) deploy = collections.OrderedDict() default_image = "alex/mongodb_1" deploy["mongo_D1"] = (default_image, "mongod --smallfiles --replSet xxx", 27017) deploy["mongo_D2"] = (default_image, "mongod --smallfiles --replSet xxx", 27017) deploy["mongo_CFG"] = (default_image, "mongod --smallfiles", 27017) deploy["mongo_S1"] = (default_image, "mongos --configdb mongo_CFG:27017", 27017) res = docker.deploy(deploy) if res != 1: print("Failed deploying. Aborting") docker.cleanup() sys.exit(2) # initialize it replSetConfig = { "_id" : "xxx", "members" : [
import mdocker from mdocker import wait_until_up, wait_to_become_primary, MDocker import pymongo from pymongo import MongoClient import collections from timeit import default_timer as timer from pymongo import ReadPreference import time # create an instance of MDocker docker = MDocker() # create new system (image, params, sleep time) deploy = collections.OrderedDict() default_image = "alex/mongodb_26_auth_ent" deploy["mongo_D1"] = ( default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --replSet xxx --keyFile /usr/local/bin/keyfile", 27017, ) deploy["mongo_D2"] = ( default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --replSet xxx --keyFile /usr/local/bin/keyfile", 27017, ) deploy["mongo_CFG1"] = ( default_image, "mongod --sslMode preferSSL --sslPEMKeyFile /usr/local/bin/cert.pem --smallfiles --keyFile /usr/local/bin/keyfile", 27017, ) deploy["mongo_CFG2"] = (