Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to update a tag value of service without impact the service and session ID in KV store? #867

Closed
deadjoe opened this issue Apr 16, 2015 · 8 comments

Comments

@deadjoe
Copy link

deadjoe commented Apr 16, 2015

two services were registered into the consul with different "tag" like "master" and "slave".

How to update these two tags without impact correspond services(these two services are also join the election via session acquiring ) and related session ID in the KV store ?

for now the way to me is to deregister them and re-register tags with the new value.But that will do great impaction to running services and their status.

Thanks,

@armon
Copy link
Member

armon commented Apr 23, 2015

@deadjoe You can just re-register the services with the updated tags. No need to deregister first.

@fidian
Copy link

fidian commented Jun 4, 2015

Could the documentation be updated to reflect this? For the /v1/agent/service/register endpoint I see phrases like "Registers a new local service" and "You cannot have duplicate ID entries per agent ...".

Perhaps there could also be a new endpoint? /v1/agent/service/tags/<serviceId> could get a JSON array of tags sent via POST or PUT? When a GET is issued, the current tags could be retrieved? This would make it really easy for me to update a service's tags and I could check to see if they already match and skip POSTing the data.

Another alternative would be something along the lines of issuing a POST to /v1/agent/service/tags/<serviceId>/+<tag> and /v1/agent/service/tags/<serviceId>/-<tag>.

Like the user in issue #155, I would like to add a master tag to my mongodb instance as long as it is the master. In my ideal world I would have a tag based on a health check (run some command every X seconds; apply/remove a tag based on its result), though I don't see anything remotely like that.

@fidian
Copy link

fidian commented Jun 19, 2015

I split my last paragraph into a new suggestion instead of trying to hijack this one.

@kamilchm
Copy link

@armon is there a way to add tag with register atomically?
What if there are other changes in tags between initial register and re-register? Right now, I need to GET current tags with one call and PUT new tags in a second call. I could overwrite changes done by someone else by accident. How can I do it properly?

@sethvargo
Copy link
Contributor

Hi all,

The API documentation has been updated to reflect these changes. If you see any places where we missed it, please let us know (or open a PR!) 😄

@kamilchm
Copy link

kamilchm commented May 4, 2017

Hi @sethvargo,
which PR do you mean as these changes?

@sandstrom
Copy link
Contributor

I know this is possible already, via the catalog API. But it would be nice if it was easier. E.g. a CLI command or an HTTP endpoint specifically for the tags.

/catalog/register is quite low-level, where basically either a node, service or check can be registered using the same endpoint. Or a combination all at once.

It's not the easiest one to use, especially if tags are to be used for ops, to change primary node etc. In these cases a simpler HTTP API or a CLI command would go a long way 😄

@sethvargo
Copy link
Contributor

CLI commands are on the roadmap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants