Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ubuntu 领事:运行状况检查无法调用:fork/exec,但正在手动运行_Ubuntu_Consul_Hashicorp Vault - Fatal编程技术网

Ubuntu 领事:运行状况检查无法调用:fork/exec,但正在手动运行

Ubuntu 领事:运行状况检查无法调用:fork/exec,但正在手动运行,ubuntu,consul,hashicorp-vault,Ubuntu,Consul,Hashicorp Vault,我运行这个命令 /usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root --password=123 上面写着 mysqld is alive 但当我把它加入健康检查时 "check": { "args": ["/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"], "

我运行这个命令

/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root --password=123
上面写着

mysqld is alive
但当我把它加入健康检查时

   "check": {
     "args": ["/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"],
     "interval": "3s"}
   }
日志上写着

[ERR] agent: Check "service:proxy2" failed to invoke: fork/exec /usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123: no such file or directory
如何解决此问题?

args-应该是字符串数组。领事将您的单个字符串视为要执行的命令,忽略空格

您的支票应如下所示:

   "check": {
     "args": ["/usr/bin/mysqladmin", "ping", "--host=192.168.56.35", "--port=6033", "--user=root", "password=123"],
     "interval": "3s"}
   }
您也可以选择使用以下内容,因为字符串被传递到/bin/sh,所以它不必被划分为子字符串。for CONSOR CHECK中的大多数示例都使用此语法,因此它肯定会起作用:

   "check": {
     "args": ["/bin/sh", "-c", "/usr/bin/mysqladmin ping --host=192.168.56.35 --port=6033 --user=root password=123"],
     "interval": "3s"}
   }
另外,请确保运行Consor代理进程的用户能够执行/usr/bin/mysqladmin,否则将出现权限拒绝错误