From e93e417310b5f8ce6f67b0f1d4abbf7fe302e48b Mon Sep 17 00:00:00 2001 From: apple Date: Fri, 13 Jan 2023 15:36:24 +0100 Subject: [PATCH] ProxySQL add reader node if not in reader group --- cluster/prx_proxysql.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster/prx_proxysql.go b/cluster/prx_proxysql.go index 137dceffb..ca201a741 100644 --- a/cluster/prx_proxysql.go +++ b/cluster/prx_proxysql.go @@ -409,8 +409,10 @@ func (proxy *ProxySQLProxy) Refresh() error { cluster.sme.AddState("ERR00072", state.State{ErrType: "WARNING", ErrDesc: fmt.Sprintf(clusterError["ERR00072"], err, s.URL), ErrFrom: "PRX", ServerUrl: proxy.Name}) } updated = true + } else if s.IsSlave && !isFoundBackendRead && !s.IsIgnored() { + err = psql.AddServerAsReader(misc.Unbracket(s.Host), s.Port, "1", strconv.Itoa(s.ClusterGroup.Conf.PRXServersBackendMaxReplicationLag), strconv.Itoa(s.ClusterGroup.Conf.PRXServersBackendMaxConnections), strconv.Itoa(misc.Bool2Int(s.ClusterGroup.Conf.PRXServersBackendCompression)), proxy.UseSSL()) + updated = true } - } //if bootstrap // load the grants