0

默认值:开

# 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)
4

2 回答 2

0

您是否尝试过以下而不是/usr/bin/mysqlclustercheck

server = /usr/bin/clustercheck

我想知道您是否可以使用 linux which 命令测试您的二进制位置。

于 2016-03-14T21:09:53.360 回答
0

很久以前有人问过这个问题,但它刚刚引起了我的注意。

首先如前所述,调用 Percona Cluster Control 脚本clustercheck,因此请确保您使用正确的名称和正确的路径。

其次,由于服务器脚本从命令行运行良好,在我看来客户端命令的路径在运行集群控制脚本时mysql是不知道的。xinetd

由于mysqlclustercheck脚本由 Percona 提供,因此它仅使用二进制名称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 服务器。mysqlclustercheckPercona 提供的脚本,它使用用户/密码来连接 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 时遇到了这个脚本的问题,我终于设法以“root”而不是“nobody”的身份运行它。

希望能帮助到你

于 2017-12-15T14:26:06.427 回答