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

MySQL读写分离,写入后读不到最新数据 #433

Open
TFdream opened this issue Jan 31, 2023 · 0 comments
Open

MySQL读写分离,写入后读不到最新数据 #433

TFdream opened this issue Jan 31, 2023 · 0 comments

Comments

@TFdream
Copy link
Owner

TFdream commented Jan 31, 2023

MySQL读写分离,写完读不到问题如何解决:https://www.51cto.com/article/648803.html

今天我们来详细了解一下主从同步延迟时读写分离发生写后读不到的问题,依次讲解问题出现的原因,解决策略以及 Sharding-jdbc、MyCat 和 MaxScale 等开源数据库中间件具体的实现方案。

读写分离目的

为了减少主库的读压力,通过横向扩展1个或多个从库来提升应用读数据库的性能,分担主库的读压力,因为大部分网站都是读多写少。

常见的解决策略

一般来讲,大致有如下方案解决写后读不出问题:

  • 强制走主库
  • 判断主备无延迟
  • 等主库位点或 GTID 方案
  • 增加缓存标记(以业务ID为key,缓存可以是 Redis、本地缓存、客户端缓存等)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant