我有以下设置:

read_only = 1我有以下ProxySQL配置:
mysql_servers = (
{ address = "galera-1" port = 3306 hostgroup = 2 },
{ address = "galera-2" port = 3306 hostgroup = 2 },
{ address = "galera-3" port = 3306 hostgroup = 2 },
{ address = "galera-2" port = 3306 hostgroup = 5
max_replication_lag = 5 },
{ address = "slave-1" port = 3306 hostgroup = 5
max_replication_lag = 5 },
{ address = "slave-2" port = 3306 hostgroup = 5
max_replication_lag = 5 },
{ address = "slave-3" port = 3306 hostgroup = 5
max_replication_lag = 5 }
)
mysql_galera_hostgroups = (
{
active = 1
backup_writer_hostgroup = 4
max_transactions_behind = 100
max_writers = 1
offline_hostgroup = 1
reader_hostgroup = 3
writer_hostgroup = 2
writer_is_also_reader = 0
}
)
mysql_replication_hostgroups = (
{
writer_hostgroup = 5
reader_hostgroup = 6
}
)使用此配置:
如何以循环方式将读取查询路由到hostgoups 3、4或6?
mysql_query_rules =
(
{
rule_id = 100
active = 1
match_pattern = "^SELECT .* FOR UPDATE"
destination_hostgroup = 2
apply = 1
},
{
rule_id = 200
active = 1
match_pattern = "^SELECT .*"
destination_hostgroup = 6
apply = 1
},
{
rule_id = 300
active = 1
match_pattern = ".*"
destination_hostgroup = 2
apply = 1
}
)我尝试过在Galera和MySQL复制之间混合组,但是事情变得非常混乱。
是否有办法创建一个主机组,以便我可以路由到“组”?
发布于 2023-04-10 14:34:22
调查一下,我找到了一个可能的解决方案,但我觉得有点过火了。安装3个ProxySQL服务器,以便在Galera和主/从副本之间进行读/写分离。

有什么评论吗?如果只使用一台ProxySQL服务器就能实现这一点,那就太好了。
https://dba.stackexchange.com/questions/325606
复制相似问题