I have a scenario where I've got a database cluster running, and would like the clients to use a Consul DNS address (e.g. master.db.service.consul) to connect to the cluster master for writing. I can set the tags manually so that only the master server has the 'master' tag and configure the cluster weights so that one server is the master when available, but this means that I'll still need intervention to change the Consul tags if the master needs to be set to a different server (e.g. for a rolling update).
Is there a way of populating the tags in the Consul config file based on the output of a script? For example something like
{
"service": {
"name": "dbcluster",
"id": "dbcluster01",
"port": 6000,
"tags": /some/script.sh,
"check": {
"script": "nc -zv 127.0.0.1 6000",
"interval": "10s"
}
}
}
Barring that, what would be the next best option?
Regards...