Distributed locking with "virtual" node

I’m trying to use Consul as coordinator for distributed locking. Support for this seems straightforward - establish a session, use the session to acquire lock in kv. My problem is that according to docs, session is tightly coupled with the node it relates to and it’s health. So if I have a cluster, the session gets automatically created on consul-0 and that that specific node goes down for some reason, I would loose all of the sessions registered against that node. I can indicate that session should be bound to specific node, so I wanted to create a “virtual” node that will never crash but when I did that, creating a session on this node fails with apply failed: Missing check 'serfHealth' registration Is there any way to achieve locks that are not tightly coupled to explicit consul cluster node ?

The question that springs to my mind is: why would you want to do that? If you’re locking, it means an application is going to be doing something that requires it, and those applications tend to run on nodes. So yes, if the node goes down, you lose the sessions and locks obtained because the apps using said session and locks are no longer actually running.

Maybe I’m getting this all wrong, but… it would probably help if you describe your use case a little :wink: