MySQL主从同步初始化注意事项

羌俊恩 社区创始人
运维领域优质创作者
博客专家认证
2022-09-13 09:47:50

1)RESET MASTER;

RESET MASTER removes all binary log files that are listed in the index file, leaving only a single, empty binary log file with a numeric suffix of .000001, whereas the numbering is not reset by PURGE BINARY LOGS.

RESET MASTER is not intended to be used while any replication slaves are running. The behavior. of RESET MASTER when used while slaves are running is undefined (and thus unsupported), whereas PURGE BINARY LOGS may be safely used while replication slaves are running.
 

2)RESET SLAVE;

RESET SLAVE makes the slave forget its replication position in the master's binary log. This statement is meant to be used for a clean start: It deletes the master.info and relay-log.info files, all the relay log files, and starts a new relay log file. To use RESET SLAVE, the slave replication threads must be stopped (use STOP SLAVE if necessary).
 

 

...全文
48 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

107,823

社区成员

发帖
与我相关
我的任务
社区描述
欢迎各位小伙伴积极活跃投稿,将日常IT打怪中遇到的问题,优秀解决方案,或自己的博客认为比较经典的文章分享到这里,共同营造一个悦享的问题库,Review及减少重复造车轮的无限循环,此致敬礼
devops经验分享开源 技术论坛(原bbs) 北京·西城区
社区管理员
  • 羌俊恩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

本社区:旨在推进运维云化知识库建设,为更多运维提供参考及经验交流;加入社区的同学,如果运维工作中遇到问题或最后得到解决,有劳凑空发帖,分享共建FAQ社区。

得到解决方案的同学,请积极为发帖的同学点赞、评论、能力范围内打赏激励。另外本社区采用游戏修仙角色作为鼓励,对不同贡献者授予对应“勋章”。

最后祝愿社区繁荣昌盛,此致敬礼!!!

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