Hello,
I have set up a proxysql instance, with 3 mysql servers.
The setup is configured with mysql_replication_hostgroups, since the one of the nodes (writer) is part of a galera cluster, and the other 2 (reader1, reader2) are async (slave) nodes.
What I am trying to achieve is:
All writes go to the writer node, all reads go to the reader1 node.
If writer node fails, do not accept write operations, only reads.
If reader1 node fails, read from reader2.
That's it.
The writer node is is in the writer hostgoup (2).
The other two nodes, are in the reader hostgroup (3).
# select hostname, hostgroup_id, weight, status from mysql_servers;
+------------------------------+--------------+---------+--------+
| hostname | hostgroup_id | weight | status |
+------------------------------+--------------+---------+--------+
| writer | 2 | 1000000 | ONLINE |
| reader1 | 3 | 10000 | ONLINE |
| reader2 | 3 | 100 | ONLINE |
+------------------------------+--------------+---------+--------+
Now, the problem is, that in the proxysql runtime, reader2 node somehow gets appended in the writer hostgroup (2), an I do not understand why:
# select hostname, hostgroup_id, weight, status from runtime_mysql_servers;
+------------------------------+--------------+---------+--------+
| hostname | hostgroup_id | weight | status |
+------------------------------+--------------+---------+--------+
| writer | 2 | 1000000 | ONLINE |
| reader2 | 2 | 100 | ONLINE |
| reader1 | 3 | 10000 | ONLINE |
| reader2 | 3 | 100 | ONLINE |
+------------------------------+--------------+---------+--------+
I stop the writer, run a hostgroup 2 command (e.g. create database), and the database is created on reader2 node.
Note that I cannot set the reader2 node in read_only, as it's being used by other applications / purposes etc.
Any advise will be appreciated
Thank you