Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

切主以后,主从同步失败,一直报错。 #1106

Closed
isoleo opened this issue Nov 8, 2021 · 6 comments
Closed

切主以后,主从同步失败,一直报错。 #1106

isoleo opened this issue Nov 8, 2021 · 6 comments

Comments

@isoleo
Copy link

isoleo commented Nov 8, 2021

pika3.3.6
当把从提升为主以后,旧主再向旧从同步时,会报如下错误。
info 里边为 db0 error 。同步失败。

新主 :W1108 11:18:44.244881 175570 pika_repl_server_conn.cc:274] Slave offset is not a start point of cur log, Slave ip: 172.22.12.108, Slave port: 9221, Partition: db0, cloest start point, filenum: 645, offset: 16763735

新从:
W1108 11:30:30.241708 176047 pika_repl_client_thread.cc:49] Master conn timeout : 172.22.11.44:11221 try reconnect
W1108 11:30:40.179070 176051 pika_repl_client_conn.cc:267] Partition: db0 TrySync Error
W1108 11:31:42.312289 176047 pika_repl_client_thread.cc:49] Master conn timeout : 172.22.11.44:11221 try reconnect
W1108 11:31:52.234664 176053 pika_repl_client_conn.cc:267] Partition: db0 TrySync Error
W1108 11:32:54.383277 176047 pika_repl_client_thread.cc:49] Master conn timeout : 172.22.11.44:11221 try reconnect
W1108 11:33:04.183563 176055 pika_repl_client_conn.cc:267] Partition: db0 TrySync Error

@kernelai
Copy link
Collaborator

kernelai commented Nov 8, 2021

主从切换时,由于有部分binlog slave没有获得,因此master slave的binlog在当时是不相同的。对于pika设计这个命令的时候,考虑到这是个严重问题,需要人为介入。因此需要slaveof masterIp masterPort --force才能强制新slave 全同步。

@kernelai
Copy link
Collaborator

kernelai commented Nov 8, 2021

对于想忽略这个问题,直接自动全同步,pika需要给出一个开关选项(默认关闭),在管理员已知的的情况下,可以自动强制全同步。这部分功能需求,需要参考下redis的设计。

@isoleo
Copy link
Author

isoleo commented Nov 8, 2021

优秀。

@isoleo
Copy link
Author

isoleo commented Nov 8, 2021

优化切换逻辑确实是最终的解决方案,其实可以在Slave offset is not a start point of cur log 这段错误日志中,增中一个提示,slaveof masterIp masterPort --force 。

@wanghenshui
Copy link
Collaborator

wanghenshui commented Jan 9, 2022

后面优化考虑引入主写入限速,不能超过过长落后

@huadaonan
Copy link

但是加了force依然不生效 不可以正常同步数据

@luky116 luky116 closed this as completed May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants