【问题标题】:consul-template does not work on remote machine领事模板在远程机器上不起作用
【发布时间】:2016-10-28 07:38:55
【问题描述】:

我有三台机器,例如:

[consul@cjportal]$ consul members
 Node                   Address              Status  Type    Build    Protocol  DC
 portal1                192.168.11.155:8301  alive   client   0.7.0     2       dc1
 portal0                192.168.14.100:8301  alive   client   0.7.0     2       dc1
 portal2                192.168.11.182:8301  alive   server   0.7.0     2       dc1

并且所有 3 台机器都有相同的 consul 配置文件,例如:

{
"service":{   
    "name":"portal_confgen",
    "tags":[                                                                                                                            
        "portal"
        ],  
    "address": "127.0.0.1",
    "port": 8823,
    "check":{
        "name":"ping",
        "script":"ping -c1 192.168.11.155",
        "interval":"10s"
    }   
  }   
}

所有3台机器都运行consul,只有服务器portal2运行consul-template,使用命令:

consul-template -config=/home/consul/consul-template/config/hosts.hcl  -consul=localhost:8500

我的领事模板配置文件,hosts.hcl:

 template {
    source = "/home/consul/consul-template/hosts.ctmpl"
    destination = "/home/consul/conf/conf.d/test.conf"
 }

但是当我在consul存储中更改k/v时,只有localhost portal2正确写入目标文件,远程机器portal0和portal1不起作用。我错过了什么???

【问题讨论】:

  • 我必须在每台机器上运行 consul-template 吗???

标签: consul consul-template


【解决方案1】:

您需要在所有服务器上运行 consul-template。 你期待什么?如果你只在portal2上运行consul模板,那么只有它会被更新,如果你将在portal0和portal1上运行它,它们也会被更新

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-04-23
    • 2013-08-21
    • 1970-01-01
    • 2013-02-12
    • 1970-01-01
    • 2016-06-23
    • 1970-01-01
    • 2014-07-03
    相关资源
    最近更新 更多