diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index 71f28c186..1aecaabda 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -982,6 +982,18 @@ def replSetNode(): nodes = c['nodes'] add_node = args['node'].strip() + priority = -1 + if 'priority' in args: + priority = args['priority'].strip() + priority = int(priority) + if priority<0 or priority>100: + return mw.returnJson(False, 'priority应该在[0-100]之间!') + + arbiterOnly = 0 + if 'arbiterOnly' in args: + priority = args['arbiterOnly'].strip() + arbiterOnly = int(arbiterOnly) + is_have = False for x in nodes: if x['host'] == add_node: @@ -992,6 +1004,9 @@ def replSetNode(): t = {} t['host'] = add_node + t['priority'] = priority + t['arbiterOnly'] = arbiterOnly + nodes.append(t) c['nodes'] = nodes setReplConfigData(c) diff --git a/plugins/mongodb/js/mongodb.js b/plugins/mongodb/js/mongodb.js index 63294f682..b5c3c227d 100644 --- a/plugins/mongodb/js/mongodb.js +++ b/plugins/mongodb/js/mongodb.js @@ -265,16 +265,34 @@ function mongoReplCfgNodes(){ btn:["提交","关闭"], content: "