consul报错:invalid config key service.check.script

问题:

2022-08-11T04:11:22.280+0200 [ERROR] agent.http: Request error: method=PUT url=/v1/agent/reload from=127.0.0.1:39340 error="failed to parse consul.d/docker_test.json: 1 er
ror occurred:
* invalid config key service.check.script

解释:

早期的consul check使用 service.check.script 进行配置。
新版本的consul check使用 service.check.args进行配置;

解决:

Consul shows script is a invalid config key

https://stackoverflow.com/questions/50742333/consul-shows-script-is-a-invalid-config-key

简介:

#NOTE: stackoverflow上的一个记录。 



I am trying to run a shell script to do the health check using consul. I am able to do the HTTP checks but when I try the script its throwing error. ( maybe some silly mistake )

Config File

{
 "services": [
   {
     "name": "test",
     "checks": [
         {
           "script": "./test.sh",
           "interval": "15s"
         }
       ]
     }
   ] 
}


Run

./consul agent -enable-script-checks=true -ui -dev -config-dir=.     


Output

==> Error parsing web.json: 1 error(s) occurred:

* invalid config key services[0].checks[0].script




change your configure variable,change “script” to “args”.

for example:

"args": [
    "/usr/local/bin/check_mem.py",
    "-limit",
    "256MB"
],
it should solve your problem
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 服务发现的定义: 服务发现是伴随着微服务体系而产生的。在微服务诞生以前,又或者我们的网络应用没有那么大的并发请求量...
    大匡先生阅读 1,529评论 0 1
  • 本手册根据官方资料整理,暂时只收集了最基本最常用的那部分。由于作者水平有限,涉及企业版和高级功能的接口用法,请您参...
    大匡先生阅读 4,250评论 0 1
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,156评论 19 139
  • 1. 启动consul consul agent -dev(开发环境下启动) consul agent -s...
    风_ee76阅读 1,520评论 0 0
  • 目标 基于openresty 和 lua 参考apisix的后台实现一个自己的网关那首先要搭建一个apisix 啊...
    dozenx阅读 987评论 0 1