Mysql Router 向 down 从属节点发送请求一秒钟

Mysql Router send request to down slave node for a Second

我已经使用 MySql 路由器(版本 - 2.1.4)为 HA 实现了 InnoDB 集群 这是我的 mysqlrouter.conf 文件

[DEFAULT]
user=mysqlrouter
logging_folder=
runtime_folder=/tmp/mysqlrouter/run
data_folder=/tmp/mysqlrouter/data
keyring_path=/tmp/mysqlrouter/data/keyring
master_key_path=/tmp/mysqlrouter/mysqlrouter.key

    [logger]
    level = DEBUG

    [metadata_cache:magentoCluster]
    router_id=49
    bootstrap_server_addresses=mysql://ic-1:3306,mysql://ic-2:3306,mysql://ic-3:3306
    user=mysql_router49_sqxivre03wzz
    metadata_cluster=magentoCluster
    ttl=1

    [routing:magentoCluster_default_rw]
    bind_address=0.0.0.0
    bind_port=6446
    destinations=metadata-cache://magentoCluster/default?role=PRIMARY
    mode=read-write
    protocol=classic

    [routing:magentoCluster_default_ro]
    bind_address=0.0.0.0
    bind_port=6447
    destinations=metadata-cache://magentoCluster/default?role=ALL
    mode=read-only
    protocol=classic

    [routing:magentoCluster_default_x_rw]
    bind_address=0.0.0.0
    bind_port=64460
    destinations=metadata-cache://magentoCluster/default?role=PRIMARY
    mode=read-write
    protocol=x

    [routing:magentoCluster_default_x_ro]
    bind_address=0.0.0.0
    bind_port=64470
    destinations=metadata-cache://magentoCluster/default?role=ALL
    mode=read-only
    protocol=x

MySql 路由器将读取请求拆分到从属节点,如果我关闭从属节点 1,则路由器需要几秒钟时间才能知道从属节点 1 已关闭。所以请求发送到down的slave节点,请求失败。关于如何处理此失败的任何建议?

客户端应始终检查错误。这对任何系统都是必需的,因为在任何配置中都可能发生网络错误、断电等。

当客户端发现连接失败(连接失败/连接断开)时,它应该通过重新连接并重放它正在处理的事务来重新开始。

为了交易的完整性,客户必须参与该过程;恢复不能由任何代理提供。