Napsty / check_mysql_slavestatus

Monitoring plugin to check the Status of a MySQL/MariaDB replication slave
15 stars 15 forks source link

Specifying a socket in the connection settings file MariaDB still uses TCP as -P is used #16

Open aj-gh opened 1 year ago

aj-gh commented 1 year ago

When connection options are read from an options file (-o) a socket specified in there is ignored by MariaDB as check_mysql_slavestatus still sets -P 3306 which causes MariaDB to use TCP. MariaDB warning: WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol. We noticed that due to an error from check_mysql_slavestatus CRITICAL: Unable to connect to server as we had only allowed "localhost" but at the same time disabled name resolution (reverse dns) by setting skip-name-resolve=on. That way the tcp connect from 127.0.0.1 no longer matched the permitted host "localhost".

Workaround: Specify socket again on the command line, a valid user and a dummy password; the password will be overwritten with the value read from the options file. This will cause check_mysql_slavestatus not to use -P towards MariaDB. Only specifying the socket file doesn't work as user/password are required parameters in that case. Example: check_mysql_slavestatus.sh -o mysql.credentials -S /run/mysqld/mysqld.sock -u monitoring -p dummy ...

Tested with: MariaDB 10.6.11