def startSlave(db_path, master, **kwargs): ''' Mandatory parameter: master address Example: mongo = Mongo() mongo.startSlave("192.168.2.100:27020") ''' slave = Replication(is_master=False, **kwargs) slave.dbPath(db_path) slave.source(master) slave.initParamaters() slave.start()
def startMaster(db_path, **kwargs): master = Replication(is_master=True, **kwargs) master.dbPath(db_path) master.initParamaters() master.start()
def slaveStatus(**kwargs): slave = Replication(is_master=False, **kwargs) return slave.slaveInfo()
def masterStatus(**kwargs): master = Replication(is_master=True, **kwargs) return master.masterInfo()