mongodb副本集修改配置问题

因虚拟机地址被占用,需要重新设置ip地址,这时需要修改副本集中的IP地址配置:

1: 查看配置rs.config();需要找到primary主机,在该主节点服务器上才有权限修改配置

 

2:rs.remove("ip:port") 移除原配置文件中的已经变更地址的主机

 

3:rs.add("ip:port")  添加新的地址主机

 

4:设置priority优先级

>var config = rs.config()

>config.members[2].priority=2

>rs.reconfig(config)         //重新更新配置

猜你喜欢

转载自blog.csdn.net/lemontree1945/article/details/80334985
今日推荐