Ich habe drei machins wie funktioniert:Konsul-Vorlage nicht auf Remote-Rechner
[[email protected]]$ 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
und alle drei Maschinen hat die gleiche Konsul Konfigurationsdatei wie:
{
"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"
}
}
}
und alle drei Maschinen Konsul laufen nur Server portal2 Konsul-Vorlage ausgeführt wird, verwenden Sie den Befehl:
consul-template -config=/home/consul/consul-template/config/hosts.hcl -consul=localhost:8500
meine Konsul-Template-Konfigurationsdatei, hosts.hcl:
template {
source = "/home/consul/consul-template/hosts.ctmpl"
destination = "/home/consul/conf/conf.d/test.conf"
}
Aber wenn ich k/v in Konsuls Speicherung zu ändern, nur localhost portal2 schreibt korrekt Zieldatei, Remote-Rechnern portal0 und portal1 nicht funktioniert work.What ich vermisse ???
Muss ich Consul-Vorlage auf jeder Maschine ausführen ??? –