Answer the question
In order to leave comments, you need to log in
How to force dns consul to give live ip?
How to make the internal dns of the consul give only a live ip on which the service is running, well, postgres for example. Did so
consul.d# cat postgres.json
{
"services":[
{
"id":"pg_dbmaster",
"name":"postgres",
"address":"8.8.8.8",
"tags":[
"master"
],
"port":5432
},
{
"id":"pg_dbread",
"name":"postgres",
"address":"127.0.0.1",
"tags":[
"slave"
],
"port":5432,
"check":{
"name":"pg_dbread_check",
"tcp":"localhost:5432",
"interval":"10s",
"timeout":"1s"
}
}
]
}
dig @127.0.0.1 -p 8600 postgres.service.consul A +short
8.8.8.8
dig @127.0.0.1 -p 8600 postgres.service.consul A +short
8.8.8.8
127.0.0.1
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question