# All server in hostgroup are at status shunned

**URL:** https://forums.percona.com/t/all-server-in-hostgroup-are-at-status-shunned/13298
**Category:** ProxySQL
**Created:** [December 1, 2021, 6:57am UTC](https://forums.percona.com/t/all-server-in-hostgroup-are-at-status-shunned/13298 "2021-12-01T06:57:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nativ\_Adler](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nativ_adler/32/5210_2.png) [@Nativ\_Adler](https://forums.percona.com/u/Nativ_Adler)
#### Post date: [December 1, 2021, 6:57am UTC](https://forums.percona.com/t/all-server-in-hostgroup-are-at-status-shunned/13298/1 "2021-12-01T06:57:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)
#### Post date: [December 1, 2021, 3:14pm UTC](https://forums.percona.com/t/all-server-in-hostgroup-are-at-status-shunned/13298/2 "2021-12-01T15:14:43Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Nativ\_Adler](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/nativ_adler/32/5210_2.png) [@Nativ\_Adler](https://forums.percona.com/u/Nativ_Adler)
#### Post date: [December 2, 2021, 8:13am UTC](https://forums.percona.com/t/all-server-in-hostgroup-are-at-status-shunned/13298/3 "2021-12-02T08:13:13Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)
#### Post date: [December 2, 2021, 12:30pm UTC](https://forums.percona.com/t/all-server-in-hostgroup-are-at-status-shunned/13298/4 "2021-12-02T12:30:28Z")

</div>

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.
