读写分离配置后,从节点异常无法进行只读查询

读写分离配置后,从节点异常后,无法进行只读查询

使用环境:

Sharding Proxy 5.1.2

场景、问题:

读写配置如下:

rules:
- !DB_DISCOVERY
  dataSources:
    ds_0:
      dataSourceNames:
        - ds_01
        - ds_02
      discoveryHeartbeatName: replication_delay_heartbeat_0
      discoveryTypeName: replication_delay_0
  discoveryHeartbeats:
    replication_delay_heartbeat_0:
      props:
        keep-alive-cron: '0/1 * * * * ?'
  discoveryTypes:
    replication_delay_0:
      type: MySQL.NORMAL_REPLICATION
      props:
        delay-milliseconds-threshold: 10000

- !READWRITE_SPLITTING
  dataSources:
    ds_1:
      type: Dynamic
      props:
        auto-aware-data-source-name: ds_0
        write-data-source-query-enabled: true
      loadBalancerName: wright_ds
  loadBalancers:
    wright_ds:
      type: WEIGHT
      props:
        ds_01: 100
        ds_02: 100

现状:

  • 设置write-data-source-query-enabled: true
  • 停掉ds_02的MySQL数据库后,查询报错:
mysql> select @@server_id;
ERROR 1997 (C1997): Runtime exception: [Index 0 out of bounds for length 0]

设置write-data-source-query-enabled: true,并没有生效。

您好, write-data-source-query-enabled 这个参数是 master 分支新增的,5.1.2 版本还没有这项配置,你要用 5.1.2 就看 5.1.2 的文档吧 Readwrite-splitting :: ShardingSphere

非常感谢,我的文档当时下载的是最新的pdf,没有留意这块

京ICP备2021015875号