I have configured Proxysql with master slave.
I have only one slave configured and on. Instead of happening update
,insert
on master, It is happening on slave server. My proxysql server and slave server are same.
The query rules I have given is :
INSERT INTO mysql_query_rules (active, match_digest, destination_hostgroup, apply) VALUES (1, '^SELECT.*', 1, 0);
INSERT INTO mysql_query_rules (active, match_digest, destination_hostgroup, apply) VALUES (1, '^SELECT.*FOR UPDATE', 0, 1);
hostgroup id 0
is for update and 1
is for select
.
some result for reference is:
Admin>SELECT hostgroup_id,hostname,port,status,weight FROM runtime_mysql_servers;
+--------------+---------------+------+--------+--------+
| hostgroup_id | hostname | port | status | weight |
+--------------+---------------+------+--------+--------+
| 0 | 127.0.0.1 | 3306 | ONLINE | 1 |
| 1 | 127.0.0.1 | 3306 | ONLINE | 1 |
| 1 | 127.0.0.2 | 3306 | ONLINE | 1000 |
| 0 | 127.0.0.2 | 3306 | ONLINE | 1000 |
+--------------+---------------+------+--------+--------+
Help me so I can forward my update
,insert
query to master server which is 127.0.0.1 and select
query to slave which is 127.0.0.2