Beispiel #1
0
 def startShard(db_path, use_replica=False, servers=None, **kwargs):
     '''
         Example:
         
             1. Simple shard
                 mongo = Mongo()
                 mongo.startShard(db_path="/data/db/shard/s1/",bind_ip="172.16.101.229",port=20001)
                 
             2. With replica set enabled
                 mongo = Mongo()
                 mongo.startShard(
                     db_path="/data/db/shard/s1/",
                     use_replica=True,
                     servers="csing/alpha:27021,beta:27021",
                     bind_ip="172.16.101.229",
                     port=20001
                 )
         
     '''
     shard = Shard(db_path=db_path, **kwargs)
     if use_replica and servers is not None:
         shard.useReplicaSet(servers)
     shard.initParamaters()
     shard.start()
Beispiel #2
0
 def startShard(db_path, use_replica=False, servers=None, **kwargs):
     '''
         Example:
         
             1. Simple shard
                 mongo = Mongo()
                 mongo.startShard(db_path="/data/db/shard/s1/",bind_ip="172.16.101.229",port=20001)
                 
             2. With replica set enabled
                 mongo = Mongo()
                 mongo.startShard(
                     db_path="/data/db/shard/s1/",
                     use_replica=True,
                     servers="csing/alpha:27021,beta:27021",
                     bind_ip="172.16.101.229",
                     port=20001
                 )
         
     '''        
     shard = Shard(db_path=db_path, **kwargs)
     if use_replica and servers is not None:
         shard.useReplicaSet(servers)
     shard.initParamaters()
     shard.start()
Beispiel #3
0
 def moveTo(db, to_shard, **kwargs):
     shard = Shard(**kwargs)
     return shard.moveToPrimary(db, to_shard)
Beispiel #4
0
 def statusShards(**kwargs):
     shard = Shard(**kwargs)
     return shard.getStatus()
Beispiel #5
0
 def listShards(**kwargs):
     shard = Shard(**kwargs)
     return shard.list()
Beispiel #6
0
 def shardCollection(collection, key, **kwargs):
     shard = Shard(**kwargs)
     return shard.shardCollection(collection, key)
Beispiel #7
0
 def shardDB(db, **kwargs):
     shard = Shard(**kwargs)
     return shard.shardDb(db)
Beispiel #8
0
 def addShardNode(servers, **kwargs):
     shard = Shard(**kwargs)
     return shard.addNode(servers)
Beispiel #9
0
 def moveTo(db, to_shard, **kwargs):
     shard = Shard(**kwargs)
     return shard.moveToPrimary(db, to_shard)
Beispiel #10
0
 def statusShards(**kwargs):
     shard = Shard(**kwargs)
     return shard.getStatus()
Beispiel #11
0
 def listShards(**kwargs):
     shard = Shard(**kwargs)
     return shard.list()
Beispiel #12
0
 def shardCollection(collection, key, **kwargs):
     shard = Shard(**kwargs)
     return shard.shardCollection(collection, key)
Beispiel #13
0
 def shardDB(db, **kwargs):
     shard = Shard(**kwargs)
     return shard.shardDb(db)
Beispiel #14
0
 def addShardNode(servers, **kwargs):
     shard = Shard(**kwargs)
     return shard.addNode(servers)