Hey,
I am new with proxysql and was wandering how to deal with a scenario where of my server in a hostgroup are over the lag threshold and are at status shunned.
As i don’t want to not have any option of reading from the hostgroup, i would prefer to be able to read from the servers even with the lagging.
Is there a way to achieve that?
Thanks,
Nativ
1 Like
Hello, you can control this using the max_replication_lag parameter in mysql_servers table. Just set to 0 and the replicas should not be shunned even if they are lagging behind.
1 Like
But in this case i could have some lagging servers and some that are not, but the proxy would not know that and could send the read request to a lagging server instead of a ‘good’ server.
I would like to direct reads to a lagging server only if ALL servers are lagging and there is no ‘good’ server.
1 Like
I am not sure what you want to do is possible with built-in functionality. One possibility is configuring max-replication-lag for all servers, and writing an external script that to monitor the lag of all servers that runs every few seconds using the proxysql scheduler.
If all replicas are lagging, the script needs to update the max-replication-lag table with a value of 0 to disable the lag check temporarily. When lag recovers, the script would again set the max-replication-lag to the previous value.
1 Like