-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
heartbeat to a ttl node #385
Comments
Create a directory with a TTL, put the key in that directory and heartbeat on the directory. |
@xiangli-cmu This is the right pattern, right? I need to add it to the new docs. |
I tested on v2.0-rc2 binary, errors occured.
The question is:
|
@philips Yes, that is what I want. And the heartbeat should not notify the watchers on that directory |
@philips There is a service named logger, and it have three servers(logger0, logger1, logger2) and many producers. Logger servers register at etcd through create dir with TTL under "v2/keys/logger/serverlist". For example, logger0 create dir "v2/keys/logger/serverlist/logger0" with TTL=30sec and put key "v2/keys/logger/serverlist/logger0/addr". Logger servers heartbeat to etcd to prevent expiration. At the same moment, all producers watch the key "v2/keys/logger/serverlist" for logger server create and delete. Then, heartbeat should not notify the watchers on that directory, how to do that? What about to add filter to watch interface such as
|
@xiangli-cmu @benbjohnson Directories with TTLs are a little wonky right now: The TTLs can't be refreshed:
And a watch on a key in a directory that is expiring doesn't get an expire event:
|
@philips
|
@xiangli-cmu Ah, duh. I will make sure to add that to the docs. |
@philips I am solving the second problem now. You can expect a pr very soon. |
@YueHonghui To address your problem (do not notify watcher when a update happened)
|
@xiangli-cmu I'd rather not complicate the server side by adding something like |
@benbjohnson Agree. I will close this issue. |
@philips why would one heartbeat on the directory and not a node within the directory? Lets say I have a "services" directory and I put ttl nodes in it. I would want to update the ttl on each individual node not the entire directory. |
@defunctzombie It is a bit hacky but you can have something like:
And then heartbeat the directories instead of the config. It isn't ideal and I could see adding an API for this but I don't know what it should look like. Perhaps it is something like:
Then this request would not update the etcd-index of the key. Could you file a new bug to discuss this sort of API? |
Issue discussion continued in #1232 |
Is there a interface to reset a ttl node timeout and not impact the modifyIndex, like a heartbeat but not notify watchers? I want to use this interface to implement a discovery service. The server start, set a node and ttl, before ttl timeout, it heartbeat to etcd to prevent ttl timeout. How can I do this?
The text was updated successfully, but these errors were encountered: