MongoDB Master-Slaver模式主备切换问题

404你懂得 2018-03-05 11:07:23

下面是官网上关于 Master-Slaver模式主备切换步骤
1、 Halt writes on A using the fsync command.
2、Make sure B is up to date with the state of A.
3、 Shut down B.
4、Back up and move all data files that begin with local on B from the dbPath to remove the existing local.sources data.
Warning
Removing local.* is irrevocable and cannot be undone. Perform this step with extreme caution.
5、Start B with the --master option.
6、Do a write on B, which primes the oplog to provide a new sync start point.
7、Shut down B. B will now have a new set of data files that start with local.
8、Shut down A and replace all files in the dbPath of A that start with local with a copy of the files in the dbPath of B that begin with local.
9、Considering compressing the local files from B while you copy them, as they may be quite large.
10、Start B with the --master option.
11、Start A with all the usual slave options, but include fastsync.

关于第三步我不很明白,删除local.source data,这个local.sources data是哪个文件
...全文
888 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
rucypli 2018-03-09
  • 打赏
  • 举报
回复
可以把仲裁节点放在一个web机器上,仅仅是一个进程而已
404你懂得 2018-03-08
  • 打赏
  • 举报
回复
这样不是无法保证热备正常了,如果主和仲裁在同一台主机上,这台主机挂了,备也无法接管服务,master-slave虽然也无法自动切换,但是可以通过自定义脚本来切换
404你懂得 2018-03-08
  • 打赏
  • 举报
回复
replicat set 需要3台主机,主,备,仲裁,目前有个环境只有两台主机,无法搭建replicat set
rucypli 2018-03-08
  • 打赏
  • 举报
回复
两台也可以 仲裁放到其中一台上端口不一致即可(虽然这样不推荐)
404你懂得 2018-03-08
  • 打赏
  • 举报
回复
目前只有两台主机,需要搭建热备,故只能使用master-slave模式,local.sources可以通过use local;db.sources.stats().wiredTiger.uri来查找到,但是我移除了这个文件,mongoDB无法启动,报WiredTiger error (2) [1520299616:34915][30051:0x7f2831ba2d80], file:local/collection-0--2786426632940137551.wt, WT_SESSION.open_cursor: /var/lib/mongodb/data/db/local/collection-0--2786426632940137551.wt: handle-open: open: No such file or directory
rucypli 2018-03-08
  • 打赏
  • 举报
回复
应该搭建replicat set 翻译过来是 副本集模式
rucypli 2018-03-07
  • 打赏
  • 举报
回复
Master-Slaver你可以理解为已经废弃了

1,747

社区成员

发帖
与我相关
我的任务
社区描述
MongoDB相关内容讨论区
社区管理员
  • MongoDB社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧