【问题标题】:How to add tags to Consul watch如何给 Consul 手表添加标签
【发布时间】:2021-01-22 21:08:55
【问题描述】:

我有点困惑。我有一个这样的文件供 Consul (v.1.0.7) watch 使用。

{
  "watches": [{
      "type": "service",
      "service": "server-devenv-devplatform-common",
            "tag": ["devenv","devplatform","common"],
            "args": ["/opt/consul_watches_handler.sh"]
    }]
}

它没有按预期工作,给我这个错误:

Failed reloading watches: Failed to parse watch (map[string]interface {}{\"tag\":[]interface {}{\"devenv\", \"devplatform\", \"common\"}, \"args\":[]interface {}{\"/opt/consul_watches_handler.sh\"}}): Expecting tag to be a string)"] "stdout": "", "stdout_lines": []}

没有带有标签的行,它可以正常工作。但它是按照手册中的描述制作的:

https://www.consul.io/docs/dynamic-app-config/watches

并且也可以在带有标签的其他服务器上工作。 我将不胜感激。

【问题讨论】:

    标签: watch consul


    【解决方案1】:

    Consul 1.5.0 中添加了在服务监视处理程序中使用多个标签的功能,PR hashicorp/consul#5725

    文档中未提及此版本要求,Consul 1.5.0 changelog 中也未列出添加的功能,因此您不知道此最低版本要求是完全可以理解的。

    【讨论】:

    • 非常感谢,布莱克 Covarrubias。你帮助很大。我是 Consul 的新手,所以我不知道这些更新。旧版本的原因是在配置时,它在代码中注释了一些负责 Consul 更新的剧本。无论如何,领事更新解决了这个问题。谢谢!
    猜你喜欢
    • 2018-09-11
    • 2015-10-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-17
    相关资源
    最近更新 更多