# description: mysqlchk
service mysqlchk
{
# this is a config for xinetd, place it in /etc/xinetd.d/
disable = no
flags = REUSE
socket_type = stream
type = UNLISTED
port = 9200
wait = no
user = root
server = /usr/bin/mysqlclustercheck
log_on_failure += USERID
only_from = 0.0.0.0/0
#
# Passing arguments to clustercheck
# <user> <pass> <available_when_donor=0|1> <log_file> <available_when_readonly=0|1> <defaults_extra_file>"
# Recommended: server_args = user pass 1 /var/log/log-file 0 /etc/my.cnf.local"
# Compatibility: server_args = user pass 1 /var/log/log-file 1 /etc/my.cnf.local"
# 55-to-56 upgrade: server_args = user pass 1 /var/log/log-file 0 /etc/my.cnf.extra"
#
# recommended to put the IPs that need
# to connect exclusively (security purposes)
per_source = UNLIMITED
}
/etc/xinetd.d #
当使用/etc/xinetd.d/运行时,手动运行时脚本工作正常有点奇怪,它没有按预期工作。
In mysqlclustercheck script, instead of using --user= and passord= syntax, I am using --login-path= syntax
script runs fine when I run using command line but status for xinetd was showing signal 13. After debugging, I have found that even simple command like this is not working
mysql_config_editor print --all >>/tmp/test.txt
We don't see any output generated when it is run using xinetd ( mysqlclustercheck)
答案 0 :(得分:0)
您是否尝试过以下代替/usr/bin/mysqlclustercheck
?
server = /usr/bin/clustercheck
我想知道你是否可以使用linux which命令测试你的二进制位置。
答案 1 :(得分:0)
很久以前,自从提出这个问题以来,我只是引起了我的注意。
首先,如上所述,Percona Cluster Control脚本称为clustercheck
,因此请确保使用正确的名称和正确的路径。
其次,由于服务器脚本从命令行运行良好,在我看来mysql
客户端命令的路径在运行群集控制脚本时不为xinetd
所知。
由于Percona提供的mysqlclustercheck
脚本,它只使用二进制名mysql
而没有指定绝对路径,我建议您执行以下操作:
查找系统上mysql客户端命令的位置:
ccloud@gal1:~> sudo -i
gal1:~ # which mysql
/usr/local/mysql/bin/mysql
gal1:~ #
然后编辑脚本/usr/bin/mysqlclustercheck
并在以下行中:
MYSQL_CMDLINE="mysql --defaults-extra-file=$DEFAULTS_EXTRA_FILE -nNE --connect-timeout=$TIMEOUT \
放置您在上一步中找到的mysql客户端命令的确切路径。
我还看到你不使用MySQL连接凭证连接到MySQL服务器。 Percona提供的mysqlclustercheck
脚本,它使用用户/密码连接到MySQL服务器。
通常,您应该在命令行中执行脚本,如:
gal1:~ # /usr/sbin/clustercheck haproxy haproxyMySQLpass
HTTP/1.1 200 OK
Content-Type: text/plain
其中haproxy / haproxyMySQLpass是HAProxy监控用户的MySQL连接用户/通行证。
此外,您应该将它们指定为脚本的xinetd
设置,例如:
server = /usr/bin/mysqlclustercheck
server_args = haproxy haproxyMySQLpass
最后但并非最不重要的是,您获得的信号13是因为您尝试在xinetd
运行的脚本中编写内容。例如,如果您在mysqlclustercheck
中尝试添加类似
echo "debug message"
你可能会看到破裂的管道信号(POSIX中有13个)。
最后,我使用SLES 12.3遇到了这个脚本的问题,我最终设法运行它不是'nobody'而是'root'。
希望有所帮助