Skip to content
Discussion options

You must be logged in to vote

前置条件

dble 的读写分离功能,和心跳功能是密切相关的,当读写分离不生效时:

  1. 应该先检查后端实例的心跳是否正常,可以参考: show @@heartbeat; 说明文档
  2. 当后端节点是主从架构,且心跳语句是 show slave status 时,可参考链接:#3104
  3. 当后端节点是MGR时,参考链接:#3184

当上述配置无问题后,需要关注哪些sql dble会进行法从。

读写分离执行sql下发主从情况

先了解 读写分离功能限制

按照事务划分

  • 事务中

    1. 在事务中,执行的SQL都将发送至
  • 非事务中

  1. 语句类型区分
    • 发从
      1. Utility Statements(help语句)
      2. 大部分select语句
    • 发主
      1. use scheam、show xx
      2. 特殊select语句:select … for update、select … lock in share mode、select … into file、select @@{系统变量}
      3. 预处理语句:prepare/execute …、deallcate/drop prepare …
        c.因inner-1475调整为:预处理语句:prepare 非select 语句/execute …、deallcate/drop prepare …
      4. 临时表的增删改查
      5. 部分客户端,如jdbc设置了allowMultiQueries=true。下发multi-queries,dble不做拆分解析,直接将语句下发主
      6. select @@{系统变量}、select … into file、select 系统库表 、select…

Replies: 1 comment

Comment options

Dinosauria
Feb 21, 2022
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by PanternBao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant