Dynamically set service tags tags

521 views
Skip to first unread message

Claus Strommer

unread,
Jul 15, 2015, 5:54:05 PM7/15/15
to consu...@googlegroups.com
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...

Pablo Fischer

unread,
Jul 15, 2015, 5:59:09 PM7/15/15
to consu...@googlegroups.com
Few days ago this topic came up and Armon created a git issue to add
some kind of support for this on consul.
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/hashicorp/consul/issues
> IRC: #consul on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Consul" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to consul-tool...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/consul-tool/2062165a-2803-466c-b18c-2ea6784aeb9a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Pablo

Claus Strommer

unread,
Jul 15, 2015, 6:40:17 PM7/15/15
to consu...@googlegroups.com
Awesome!  I'll be looking forward to when that makes it into a release.

Pablo Fischer

unread,
Jul 15, 2015, 7:35:22 PM7/15/15
to consu...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages