MySQL has a policy to deny a host from reconnecting once it has reached configurable failed numbher of login attempts.
This can be set using @@global.max_connect_errors
. See here: https://dev.mysql.com/doc/refman/5.7/en/blocked-host.html
What I can't find and would be greatful if anybody can point me the way - is to ask the DB how many failed connection attempts has the DB experienced from a given host.
I'm working on a High-Availability setup between few nodes, and it's important for me to find this out - especially in our testing and integration environments.
Anybody?
You might try reading from performance_schema.host_cache . This is a dynamic view into the internal host cache, which tracks errors per host.
As you probably know, the data tracked by the host cache is reset when you execute the statement FLUSH HOSTS
.
You need to be using MySQL 5.6 and have the performance_schema enabled (which it should be by default).
mysql> select * from host_cache limit 1\G
*************************** 1. row ***************************
IP: 192.168.48.95
HOST: app.mcappface.example.com
HOST_VALIDATED: YES
SUM_CONNECT_ERRORS: 0
COUNT_HOST_BLOCKED_ERRORS: 0
COUNT_NAMEINFO_TRANSIENT_ERRORS: 0
COUNT_NAMEINFO_PERMANENT_ERRORS: 0
COUNT_FORMAT_ERRORS: 0
COUNT_ADDRINFO_TRANSIENT_ERRORS: 0
COUNT_ADDRINFO_PERMANENT_ERRORS: 0
COUNT_FCRDNS_ERRORS: 0
COUNT_HOST_ACL_ERRORS: 0
COUNT_NO_AUTH_PLUGIN_ERRORS: 0
COUNT_AUTH_PLUGIN_ERRORS: 0
COUNT_HANDSHAKE_ERRORS: 0
COUNT_PROXY_USER_ERRORS: 0
COUNT_PROXY_USER_ACL_ERRORS: 0
COUNT_AUTHENTICATION_ERRORS: 0
COUNT_SSL_ERRORS: 0
COUNT_MAX_USER_CONNECTIONS_ERRORS: 0
COUNT_MAX_USER_CONNECTIONS_PER_HOUR_ERRORS: 0
COUNT_DEFAULT_DATABASE_ERRORS: 0
COUNT_INIT_CONNECT_ERRORS: 0
COUNT_LOCAL_ERRORS: 0
COUNT_UNKNOWN_ERRORS: 0
FIRST_SEEN: 2018-03-01 19:54:39
LAST_SEEN: 2018-03-19 16:13:06
FIRST_ERROR_SEEN: NULL
LAST_ERROR_SEEN: NULL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.