1

I have three machins like :

[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

and all 3 machines has the same consul config file like:

{
"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"
    }   
  }   
}

and all 3 machines running consul , only server portal2 runs consul-template,use command:

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

my consul-template config file, hosts.hcl:

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

But when I change k/v in consul storage, only localhost portal2 writes destination file correctly, remote machines portal0 and portal1 does not work.What do I miss???

Allen Jz
  • 101
  • 2
  • 9

1 Answers1

0

You need consul-template to be ran on all servers. What are you expect? if you run consul template only on portal2 so only it will be updated, if you will run it on portal0 and portal1 they would be updated too