def __init__(self, config, db):
self.config = config
self.db = db
self.read_pref_tags = self.config.replication.read_pref_tags
self.max_lag_secs = self.config.replication.max_lag_secs
self.min_priority = self.config.replication.min_priority
self.max_priority = self.config.replication.max_priority
self.hidden_only = self.config.replication.hidden_only
self.state_primary = 1
self.state_secondary = 2
self.state_arbiter = 7
self.hidden_weight = 0.20
self.pri0_weight = 0.10
self.replset = True
self.rs_config = None
self.rs_status = None
self.primary = None
self.secondary = None
self.mongo_config = None
self.replset_summary = {}
# Get a DB connection
try:
if isinstance(self.db, DB):
self.connection = self.db.connection()
else:
raise Error("'db' field is not an instance of class: 'DB'!")
except Exception, e:
logging.fatal("Could not get DB connection! Error: %s" % e)
raise OperationError(e)
评论列表
文章目录