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

Remove shunned servers #1416

Closed
robellison opened this issue Mar 14, 2018 · 2 comments
Closed

Remove shunned servers #1416

robellison opened this issue Mar 14, 2018 · 2 comments

Comments

@robellison
Copy link

i've got a fairly dynamic environment where servers can come and go with different IP addresses
at the moment when a server on a particular IP is removed from the back-end cluster, it remains in the proxySQL mysql_servers list (obviously)
the problem is that even though the servers are shunned, periodically the come back online which causes issues - as they are then used for connections, even though there is no server there.
i need to either fix this behaviour so ProxySQL checks that the server is actually there before marking it back online or remove the shunned servers

on the latter i have this query, but for some reason it doesn't work
DELETE mysql_servers
FROM mysql_servers
LEFT JOIN
stats.stats_mysql_connection_pool
on mysql_servers.hostname = stats.stats_mysql_connection_pool.srv_host
where stats.stats_mysql_connection_pool.status = 'SHUNNED';

any help appreciated

@pondix
Copy link
Contributor

pondix commented Mar 15, 2018

Hi @robellison

The "SHUNNED" status is a temporary status, ProxySQL keeps checking if the node is back online by design in order to send connections to the server once it is available. This differs from the various OFFLINE statuses.

It is strongly recommended to DELETE the specific servers which will become inactive from ProxySQL before removing the IP address from the backend host. The SHUNNED status may be set on a host which is temporarily unavailable due to other reasons (i.e. a temporary network issue on a host that should in fact remain ONLINE) and you may inadvertently remove servers from your configuration which are still active by using the approach you've described.

In any case, regarding the query you are trying to execute, please keep in mind that although ProxySQL Admin supports the MySQL Protocol the backend is SQLite3 and you can also use the runtime_mysql_servers table to identify the actual status of a backend server. The correct statement would be:

DELETE FROM mysql_servers 
WHERE EXISTS 
  (SELECT * FROM runtime_mysql_servers WHERE status = 'SHUNNED');
LOAD MYSQL SERVERS TO RUNTIME;
SAVE MYSQL SERVERS TO DISK;

We'll look at ways to improve this behaviour.

Thanks!

INTERNAL NOTE: Left issue open and added the enhancement label to look at better ways of handling this scenario.

renecannao added a commit that referenced this issue Mar 17, 2018
This commit also prevents shunned nodes to come back online if they are missing pings. Related to #1416
Because it reduces the number of checks, it may also be relevant to #1417
@pondix
Copy link
Contributor

pondix commented May 30, 2018

@pondix pondix closed this as completed May 30, 2018
renecannao added a commit that referenced this issue Jun 6, 2018
This commit also prevents shunned nodes to come back online if they are missing pings. Related to #1416
Because it reduces the number of checks, it may also be relevant to #1417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants