Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The hostgroup_id of the mysql_servers table will always be the same #4796

Open
willzhang opened this issue Jan 19, 2025 · 0 comments
Open

The hostgroup_id of the mysql_servers table will always be the same #4796

willzhang opened this issue Jan 19, 2025 · 0 comments

Comments

@willzhang
Copy link

willzhang commented Jan 19, 2025

question

The hostgroup_id of the mysql_servers table will always be the same, but I would like it to be different, as described in the official documentation.

Image

problems

proxySQL version

root@mysql-proxy34:~# proxysql --version
2025-01-19 19:03:50 main.cpp:1965:print_jemalloc_conf(): [INFO] Using jemalloc with MALLOC_CONF: config.xmalloc:1, lg_tcache_max:16, opt.prof_accum:1, opt.prof_leak:1, opt.lg_prof_sample:20, opt.lg_prof_interval:30, rc:0
ProxySQL version 2.7.1-16-g2726c27_DEBUG, codename Truls

what i do

mysql> DELETE FROM mysql_servers;
Query OK, 3 rows affected (0.00 sec)

mysql> DELETE FROM mysql_replication_hostgroups;
Query OK, 1 row affected (0.00 sec)

mysql> LOAD MYSQL SERVERS TO RUNTIME;
SAVE MYSQL SERVERS TO DISK;Query OK, 0 rows affected (0.02 sec)

mysql> SAVE MYSQL SERVERS TO DISK;
Query OK, 0 rows affected (0.08 sec)

mysql> 
mysql> INSERT INTO mysql_servers (hostgroup_id,hostname,port) 
    -> VALUES 
    -> (10,'192.168.72.31',3306),
    -> (10,'192.168.72.32',3306),
    -> (10,'192.168.72.33',3306);
Query OK, 3 rows affected (0.01 sec)

mysql> INSERT INTO mysql_replication_hostgroups (writer_hostgroup,reader_hostgroup,check_type,comment) 
    -> VALUES (10,20,'read_only','cluster1');
Query OK, 1 row affected (0.00 sec)

mysql> 
mysql> LOAD MYSQL SERVERS TO RUNTIME;
SAVE MYSQL SERVERS TO DISK;Query OK, 0 rows affected (0.02 sec)

mysql> SAVE MYSQL SERVERS TO DISK;
Query OK, 0 rows affected (0.08 sec)

mysql> 
mysql> SELECT * FROM mysql_servers;
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname      | port | gtid_port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10           | 192.168.72.31 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 10           | 192.168.72.32 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 10           | 192.168.72.33 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
3 rows in set (0.00 sec)

mysql> 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           | 192.168.72.31 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 20           | 192.168.72.32 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
| 20           | 192.168.72.33 | 3306 | 0         | ONLINE | 1      | 0           | 1000            | 0                   | 0       | 0              |         |
+--------------+---------------+------+-----------+--------+--------+-------------+-----------------+---------------------+---------+----------------+---------+
3 rows in set (0.01 sec)

mysql> 

mysql> SELECT * FROM monitor.mysql_server_read_only_log 
    -> WHERE hostname IN ('192.168.72.31','192.168.72.32','192.168.72.33') 
    -> ORDER BY time_start_us DESC LIMIT 10;
+---------------+------+------------------+-----------------+-----------+-------+
| hostname      | port | time_start_us    | success_time_us | read_only | error |
+---------------+------+------------------+-----------------+-----------+-------+
| 192.168.72.32 | 3306 | 1737284494941954 | 2122            | 1         | NULL  |
| 192.168.72.33 | 3306 | 1737284494941680 | 1199            | 1         | NULL  |
| 192.168.72.31 | 3306 | 1737284494941553 | 2106            | 0         | NULL  |
| 192.168.72.33 | 3306 | 1737284492941290 | 768             | 1         | NULL  |
| 192.168.72.32 | 3306 | 1737284492940941 | 852             | 1         | NULL  |
| 192.168.72.31 | 3306 | 1737284492940257 | 1233            | 0         | NULL  |
| 192.168.72.31 | 3306 | 1737284490942302 | 896             | 0         | NULL  |
| 192.168.72.33 | 3306 | 1737284490941721 | 843             | 1         | NULL  |
| 192.168.72.32 | 3306 | 1737284490940200 | 1766            | 1         | NULL  |
| 192.168.72.33 | 3306 | 1737284488942969 | 885             | 1         | NULL  |
+---------------+------+------------------+-----------------+-----------+-------+
10 rows in set (0.00 sec)

mysql> 

mysql> SHOW VARIABLES LIKE 'mysql-monitor_read_only_interval';
+----------------------------------+-------+
| Variable_name                    | Value |
+----------------------------------+-------+
| mysql-monitor_read_only_interval | 2000  |
+----------------------------------+-------+
1 row in set (0.01 sec)

mysql> SHOW VARIABLES LIKE 'mysql-monitor_read_only_timeout';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| mysql-monitor_read_only_timeout | 500   |
+---------------------------------+-------+
1 row in set (0.00 sec)

mysql> 

what i hope

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant