# Question about proxysql weighting

**URL:** <https://forums.percona.com/t/question-about-proxysql-weighting/8197>\
**Category:** ProxySQL\
**Created:** [October 27, 2020, 8:26am UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197 "2020-10-27T08:26:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thaylin](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Thaylin](https://forums.percona.com/u/Thaylin)\
**Post date:** [October 27, 2020, 8:26am UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197/1 "2020-10-27T08:26:43Z")

</div>

I jsut setup a dev instance running mariadb 10.5 galera cluster and using proxysql 2.0.14 on rhel 8. I setup the system in the mysql\_galera\_hostgroups setup.

Hostgroup 1 I made the writer, 2 the reader, 3 the backup writer. I also enabled writer is a reader.

I then added machines to them

1. servera

2. serverb,serverc

weights 1,1

1. serverb,serverc

weights 10000,1000

The issue I am having is when I look at the runtime\_mysql\_servers I am seeing all the weights based off the backup writer hostgroup weights and not the reader weights,

Did me adding a hostgroup 3 override hostgroup 2?

Admin\> SELECT \* FROM mysql\_galera\_hostgroups;

±-----------------±------------------------±-----------------±------------------±-------±------------±----------------------±------------------------±--------+

| writer\_hostgroup | backup\_writer\_hostgroup | reader\_hostgroup | offline\_hostgroup | active | max\_writers | writer\_is\_also\_reader | max\_transactions\_behind | comment |

±-----------------±------------------------±-----------------±------------------±-------±------------±----------------------±------------------------±--------+

| 1 | 3 | 2 | 4 | 1 | 1 | 1 | 0 | NULL |

±-----------------±------------------------±-----------------±------------------±-------±------------±----------------------±------------------------±--------+

1 row in set (0.000 sec)

Admin\> select hostgroup\_id, comment, hostname, status, weight from runtime\_mysql\_servers;

±-------------±--------±-------------±--------±--------+

| hostgroup\_id | comment | hostname | status | weight |

±-------------±--------±-------------±--------±--------+

| 1 | | 10.76.10.222 | SHUNNED | 1000 |

| 3 | | 10.76.10.221 | ONLINE | 10000 |

| 3 | | 10.76.10.222 | ONLINE | 1000 |

| 2 | | 10.76.10.221 | ONLINE | 10000 |

| 2 | | 10.76.10.220 | ONLINE | 1000000 |

| 2 | | 10.76.10.222 | ONLINE | 1000 |

| 1 | | 10.76.10.221 | SHUNNED | 10000 |

| 1 | | 10.76.10.220 | ONLINE | 1000000 |

±-------------±--------±-------------±--------±--------+

8 rows in set (0.003 sec)

proxy\_mysql\_server { ‘10.76.10.220:3306-1’:

hostname =\> ‘10.76.10.220’,

port =\> 3306,

hostgroup\_id =\> 1,

weight =\> 1000000,

}

proxy\_mysql\_server { ‘10.76.10.221:3306-2’:

hostname =\> ‘10.76.10.221’,

port =\> 3306,

hostgroup\_id =\> 2,

weight =\> 1,

}

proxy\_mysql\_server { ‘10.76.10.222:3306-2’:

hostname =\> ‘10.76.10.222’,

port =\> 3306,

hostgroup\_id =\> 2,

weight =\> 1,

}

proxy\_mysql\_server { ‘10.76.10.221:3306-3’:

hostname =\> ‘10.76.10.221’,

port =\> 3306,

hostgroup\_id =\> 3,

weight =\> 10000,

}

proxy\_mysql\_server { ‘10.76.10.222:3306-3’:

hostname =\> ‘10.76.10.222’,

port =\> 3306,

hostgroup\_id =\> 3,

weight =\> 1000,

}

---

<div class="post-metadata">

**Author:** ![Thaylin](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Thaylin](https://forums.percona.com/u/Thaylin)\
**Post date:** [October 27, 2020, 8:34am UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197/2 "2020-10-27T08:34:49Z")

</div>

Should also point out when I pull hostgroup 1 and 2 only from mysql\_servers it shows the correct weight in there:

±-------------±-------------±-------±--------±--------+

| hostgroup\_id | hostname | status | weight | comment |

±-------------±-------------±-------±--------±--------+

| 1 | 10.76.10.220 | ONLINE | 1000000 | |

| 2 | 10.76.10.220 | ONLINE | 1 | |

| 2 | 10.76.10.221 | ONLINE | 1 | |

| 2 | 10.76.10.222 | ONLINE | 1 | |

±-------------±-------------±-------±--------±--------+

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 29, 2020, 11:25am UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197/3 "2020-10-29T11:25:08Z")

</div>

@Thaylin Please use the formatting features of the forum so that your console output is readable.

If you add a server to the backup\_writer with weight X, then, if that host gets moved into reader or writer group, the original weight X will be used.

---

<div class="post-metadata">

**Author:** ![Thaylin](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Thaylin](https://forums.percona.com/u/Thaylin)\
**Post date:** [October 29, 2020, 1:07pm UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197/4 "2020-10-29T13:07:58Z")

</div>

Sorry for the formatting. So I should set all the weights to 1? I assumed I needed to weight the writers.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 29, 2020, 2:18pm UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197/5 "2020-10-29T14:18:18Z")

</div>

mysql\_servers will always show you what you inserted. That data is not affected by the running config. runtime\_mysql\_servers will get modified by proxysql as things change. ProxySQL will never select more than 1 writer at a time in this mode so I do not think it is necessary to weight the writers.

---

<div class="post-metadata">

**Author:** ![Thaylin](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Thaylin](https://forums.percona.com/u/Thaylin)\
**Post date:** [October 29, 2020, 2:18pm UTC](https://forums.percona.com/t/question-about-proxysql-weighting/8197/6 "2020-10-29T14:18:59Z")

</div>

thank you
