3. 在从机上配置 asynchronous connection auto failover
配置 asynchronous connection auto failover 的两个函数:asynchronous_connection_failover_add_source(channel-name,host,port,network-namespace,weight)
asynchronous_connection_failover_delete_source(channel-name,host,port,network-namespace)
权重值大的被优先级选择,可以配合MGR的选举权重配置 asynchronous_connection_failover 的权重。当 MGR 节点切换,异步复制也能切换到新的主节点。SELECT asynchronous_connection_failover_add_source('mgr-single','127.0.0.1',23223,null,100);
SELECT asynchronous_connection_failover_add_source('mgr-single','127.0.0.1',23224,null,80);
SELECT asynchronous_connection_failover_add_source('mgr-single','127.0.0.1',23225,null,50);
start slave for channel 'mgr-single';