Closed uwmixa closed 1 month ago
Looks like the weight has more priority comparing to static configuration
This wasn't clear from schema reading
DOC
In reality the process of moving a node to the writer_hostgroup is not as simple as stated in the diagram.
When a new node is identified as a writer, a process for selecting the new writers takes place. This means that the node that joins is not guarantee to be a writer, or any of the nodes that previously were writers are guarantee to keep being online, after a new writer joins.
This is determined by a fixed order rule composed by: "weight + hostname + port". If a node that was previously a writer is going to be replaced by a new joined node, the previous will be kept in the writer_hostgroup, but set as SHUNNED.
But I tried changes in weight + hostname + port
and set weight
to 10
helped
MySQL [(none)]> select * from mysql_servers;
+--------------+--------------+------+-----------+--------------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+-----------+--------------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 99 | 10.10.20.5 | 3306 | 0 | OFFLINE_HARD | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.8 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 10 | 10.10.20.9 | 3306 | 0 | OFFLINE_SOFT | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 11 | 10.10.20.15 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
+--------------+--------------+------+-----------+--------------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
4 rows in set (0.000 sec)
MySQL [(none)]> select * from runtime_mysql_servers;
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10 | 10.10.20.15 | 3306 | 0 | SHUNNED | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 10 | 10.10.20.8 | 3306 | 0 | SHUNNED | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 10 | 10.10.20.9 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 11 | 10.10.20.15 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 11 | 10.10.20.8 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.15 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.8 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.9 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
8 rows in set (0.001 sec)
MySQL [(none)]> update mysql_servers set weight=10 where hostname='10.10.20.15';
Query OK, 1 row affected (0.000 sec)
MySQL [(none)]> LOAD MYSQL SERVERS TO RUNTIME;
Query OK, 0 rows affected (0.003 sec)
MySQL [(none)]> select * from mysql_servers;
+--------------+--------------+------+-----------+--------------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+-----------+--------------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 99 | 10.10.20.5 | 3306 | 0 | OFFLINE_HARD | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.8 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 10 | 10.10.20.9 | 3306 | 0 | OFFLINE_SOFT | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 11 | 10.10.20.15 | 3306 | 0 | ONLINE | 10 | 0 | 1000 | 0 | 0 | 0 | |
+--------------+--------------+------+-----------+--------------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
4 rows in set (0.000 sec)
MySQL [(none)]> select * from runtime_mysql_servers;
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10 | 10.10.20.15 | 3306 | 0 | ONLINE | 10 | 0 | 1000 | 0 | 0 | 0 | |
| 10 | 10.10.20.8 | 3306 | 0 | SHUNNED | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 10 | 10.10.20.9 | 3306 | 0 | SHUNNED | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 11 | 10.10.20.8 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 11 | 10.10.20.9 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.8 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
| 20 | 10.10.20.9 | 3306 | 0 | ONLINE | 1 | 0 | 1000 | 0 | 0 | 0 | |
+--------------+--------------+------+-----------+---------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
7 rows in set (0.001 sec)
Hi, I'm experiencing unexpected behavior for Galera hosts and write switching
Galera Hostgroups
MySQL Servers
Runtime MySQL Servers
Runtime MySQL QUery Rules:
The node
10.10.20.15
was added to Cluster as replacement for10.10.20.5
and10.10.20.15
suppossed to be a backup writer.The problem is
when I set current writer
10.10.20.9
toOFFLINE_SOFT
it is still acting as writer and no switchover happenedwaiting 10 sec and checking runtime servers
Why the
10.10.20.15
isn't becoming a writer?