Good day,
I am setting up a replication auto failover for MySQL 5.5. Yes I will be updating that, but that's what I have to work with at the moment and there currently is no auto failover mechanism in place. My solution needs to be implemented without modifying any client code, naturally.
In my case, the salve is only there for redundancy.
I have been exploring MySQL Router for it's auto switching through a pool of servers upon loss of connection, which it seems to do quite well. It's shortcoming, for my use case, is that it requires the client to recognize the connection error and retry the connection in order for them to communicate with the next database in the pool.
I tried replacing MySQL Router with ProxySQL, but I couldn't figure out how to make it work for this use case, or determine if it is even possible.
There are 2 ways I can think that are easy to implement right now:
a) you create an 2 hostgroups, HG1 for the master and HG2 for the slave. At regular interval you run a check and if
active master is not available, you move the slave from HG2 to HG1.
b)you configure both servers in the same hostgroups you insert the active master with a weight > 0, and the standby master with a weight of 0. At regular interval you run a check and if active master is not available, the weights are changed.
What I refer to "check" here is an external script to be executed by the Scheduler:
https://github.com/sysown/proxysql/blob/master/doc/scheduler.md
To be honest, I think the use of an external script executed thought ProxySQL's Scheduler is the best option, because it allows you to create your custom criteria to determine is a server is down.However, ProxySQL's query caching and connection retrying would appear to be a perfect fit in combination with MySQL Router to meet my needs, as "illustrated" below.
Client -> ProxySQL -> MySQL Router -> Master -> Slave
This setup works, but when the Master goes away, there is a delay of about a minute or so depending on the ProxySQL timeout settings I've tried.
How do I minimize the delay here?
If I do not have ProxySQL in the setup, the client immediately sees the connection loss. I have mysql-monitor_connect_interval = 2500 and can see that reflected in the MySQL Router log. It even shows right on time after MySQL Router switches to the Slave, so there's no delay there.
Any thoughts, suggestions or opinions would be greatly welcomed.
I attached my ProxySQL settings for reference.
Thanks,
Aaron
--
You received this message because you are subscribed to the Google Groups "proxysql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Aaron,Answers inline.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+unsubscribe@googlegroups.com.
Querying runtime_mysql_servers causes Admin to dump the info also in error log, true that!
Please feel free to submit a feature request.
Thanks
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+unsubscribe@googlegroups.com.
Hi Aaron,
mysql_servers is a configuration table, and doesn't change status automatically when a server goes offline.
runtime_mysql_servers shows what the Hostgroup Manager knows about the servers, and can be slightly more accurate than the config table (it shows SHUNNED).
Although, unless you set the server explicitly offline in mysql_servers, at regular intervals (all configurable) the Hostgroup Manager tries to bring the server back online because ... it is still configured as ONLINE.
This algorithm allows to automatically recover situations in which a server is only temporarily unavailable (crash, reboot, restart, network outage, etc).
Another useful table to understand the status of the servers as seen from the connection pool is stats.stats_mysql_connection_pool .
For monitoring purposes, the tables in monitor schema are very useful. This query will list the tables available from Monitor nodules:
SHOW TABLES FROM monitor;
Thanks,
René
To unsubscribe from this group and stop receiving emails from it, send an email to proxysql+unsubscribe@googlegroups.com.