mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Update index.py
This commit is contained in:
+18
-18
@@ -286,8 +286,8 @@ def test():
|
||||
'_id': 'test',
|
||||
'members': [
|
||||
# 'priority': 10
|
||||
{'_id': 0, 'host': '154.21.203.138:27014'},
|
||||
{'_id': 1, 'host': '154.12.53.216:27019'},
|
||||
{'_id': 0, 'host': '154.21.203.138:27017'},
|
||||
{'_id': 1, 'host': '154.12.53.216:27017'},
|
||||
]
|
||||
}
|
||||
|
||||
@@ -295,22 +295,22 @@ def test():
|
||||
print(rsStatus)
|
||||
|
||||
# 需要通过命令行操作
|
||||
# -> rs.initiate({
|
||||
# _id: 'test',
|
||||
# members: [{
|
||||
# _id: 1,
|
||||
# host: '127.0.0.1:27018',
|
||||
# priority: 2 // 这个priority不设置为1,值越高,当主库故障的时候会优先被选举成主库
|
||||
# }, {
|
||||
# _id: 2,
|
||||
# host: '127.0.0.1:27019',
|
||||
# priority: 0 //设置为0则不能成为主库
|
||||
# }, {
|
||||
# _id: 3,
|
||||
# host: '127.0.0.1:27020',
|
||||
# priority: 1
|
||||
# }]
|
||||
# });
|
||||
rs.initiate({
|
||||
_id: 'test',
|
||||
members: [
|
||||
{
|
||||
_id: 1,
|
||||
host: '154.21.203.138:27017',
|
||||
priority: 2 // 这个priority不设置为1,值越高,当主库故障的时候会优先被选举成主库
|
||||
},
|
||||
{
|
||||
_id: 2,
|
||||
host: '154.12.53.216:27017',
|
||||
priority: 1 //设置为0则不能成为主库
|
||||
}
|
||||
|
||||
]
|
||||
});
|
||||
|
||||
# > rs.status(); // 查询状态
|
||||
# // "stateStr" : "PRIMARY", 主节点
|
||||
|
||||
Reference in New Issue
Block a user