节点仲裁mongodb replica sets reconfig and conver a Secondary to an Arbiter
题记:写这篇博客要主是加深自己对节点仲裁的认识和总结实现算法时的一些验经和训教,如果有错误请指出,万分感谢。
replica set由于需求可能会调整节点的优先级,或者仲裁节点
Parameters: |
|
---|
Initializes a new replica set configuration. This function will disconnect the shell briefly and forces a reconnection as the replica set renegotiates which node will be primary. As a result, the shell will display an error even if this command succeeds.
rs.reconfig() provides a wrapper around the “replSetReconfig” database command.
rs.reconfig() overwrites the existing replica set configuration. Retrieve the current configuration object with rs.conf(), modify the configuration as needed and then use rs.reconfig() to submit the modified configuration object.
To reconfigure a replica set, use the following sequence of operations:
conf = rs.conf()
// modify conf to change configuration
rs.reconfig(conf)
If you want to force the reconfiguration if a majority of the set isn’t connected to the current member, or you’re issuing the command against a secondary, use the following form:
conf = rs.conf()
// modify conf to change configuration
rs.reconfig(conf, { force: true } )
Warning
Forcing a rs.reconfig() can lead to rollback situations and other difficult to recover from situations. Exercise caution when using this option.这里到遇rollback情况,可能会致使fatal态状,那么replica set就于等效失了,可以拷贝local数据文件,或者有所数据文件停止建重
文章结束给大家分享下程序员的一些笑话语录:
3G普不普及现在已经不是看终端了,而是看应用,有好的,便宜实用的应用,花1000多买个能用的智能手机应该不是什么难事。反过来说,你200元拿一个智能手机,没有好的应用,看个电影要几十元,也是没人用3G。