Hi,
My app server connect to db through proxysql, and it works at the beginning. My initial setup was single write with one master and two slaves, but then it came the replication lag issue. Hence, I then use one database for both READ and WRITE. I know this does not make sense when using proxysql, but I want to preserve the architecture in case we can solve replication lag in the near future. When changing setup, I do load new setting to runtime and save it to disk. It seems fine at the beginning, but few hours later, the WRITE server becomes SHUNNED.
mysql> select * from mysql_servers;
+--------------+---------------+------+--------+---------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+--------+---------+-------------+-----------------+---------------------+---------+----------------+---------+
| 10 | 172.31.21.111 | 3306 | ONLINE | 1000000 | 0 | 1000 | 1 | 0 | 0 | WRITE |
| 11 | 172.31.21.111 | 3306 | ONLINE | 1000 | 0 | 1000 | 0 | 0 | 0 | READ |
+--------------+---------------+------+--------+---------+-------------+-----------------+---------------------+---------+----------------+---------+
2 rows in set (0.00 sec)
mysql> select * from runtime_mysql_servers;
+--------------+---------------+------+---------+---------+-------------+-----------------+---------------------+---------+----------------+---------+
| hostgroup_id | hostname | port | status | weight | compression | max_connections | max_replication_lag | use_ssl | max_latency_ms | comment |
+--------------+---------------+------+---------+---------+-------------+-----------------+---------------------+---------+----------------+---------+
| 11 | 172.31.21.111 | 3306 | ONLINE | 1000 | 0 | 1000 | 0 | 0 | 0 | READ |
| 10 | 172.31.21.111 | 3306 | SHUNNED | 1000000 | 0 | 1000 | 1 | 0 | 0 | WRITE |
+--------------+---------------+------+---------+---------+-------------+-----------------+---------------------+---------+----------------+---------+
2 rows in set (0.00 sec)
This does not make sense at all because if this server is SHUNNED, both READ and WRITE should be SHUNNED.
Checking at application side I get the error like this:
"SQLSTATE[HY000]: General error: 9001 Max connect timeout reached while reaching hostgroup 10 after 10075ms"
I try to connect to the same database from proxysql, and it seems fine. Then I try to connect to database directly from app server, and it seems fine. Then I try to access some records and this is where I found the differences.
Proxysql to database:
connect to database => fast
use database => fast
select some record from database => fast
App server to database:
connect to database => fast
use database => fast
select some record from database => fast
App server connect to database through proxysql
connect to database => fast
use database => Extremely slow
select some record from database => fast
Is there anything that might cause this issue?