From fafa64f2c75fae4b6ffa86bdee0587aaaedbdb8c Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 6 May 2024 02:28:01 +0800 Subject: [PATCH] Update index.py --- plugins/mongodb/index.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index 3db6acbae..cdb9691df 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -1103,8 +1103,11 @@ def replInit(): info = str(e).split(',') if info[0] == 'already initialized': - config['version'] = int(now_time_t) - client.admin.command('replSetReconfig',config,force=True) + # tt = client.admin.command('add',{"host":"127.0.0.1:27017"}) + # print(tt) + + # config['version'] = int(now_time_t) + # client.admin.command('replSetReconfig',config,force=True) return mw.returnJson(True, '重置副本同步成功!') return mw.returnJson(False, str(e)) @@ -1120,7 +1123,7 @@ def replClose(): '_id': 'test', "version":1, 'members': [ - # {'_id': 1, 'host': host, 'votes':1}, + {'_id': 1, 'host': host, 'votes':1}, # {'_id': 1, 'host': '127.0.0.1:27017','votes':1}, ] } @@ -1136,8 +1139,8 @@ def replClose(): # print(repl_info) rstatus = db.command('replSetReconfig',config,force=True) - print(rstatus) - # db.command('replSetStepDown',replSetStepDown=0,secondaryCatchUpPeriodSecs=0,force=True) + + except Exception as e: # info = str(e).split(',') return mw.returnJson(False, str(e))