Apache Zookeeper/Curator 在锁上的生存时间

编程入门 行业动态 更新时间:2024-10-24 12:33:33
本文介绍了Apache Zookeeper/Curator 在锁上的生存时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

Apache Curator 锁配方(或较低级别的 ZooKeeper)中是否有任何工具可用于自动释放超过某个 TTL 的锁?如果没有,是否有处理该问题的最佳做法?我看到 Curator 会在客户端连接丢失的情况下自动释放锁,这很好……而且锁获取超时也很有帮助.

Is there any facility in the Apache Curator lock recipes (or lower-level ZooKeeper) for auto-releasing locks that have exceeded some TTL? If not, is there a best practice for dealing with that? I see that Curator automatically releases locks in the case of the client connection being lost, which is nice...and the timeout on lock acquisition is also helpful.

我想知道我需要在多大程度上保护我的系统,通过重复性的工作来寻找已经存在很长时间的锁并手动释放它们.我可以通过让我的单独进程直接删除相关的 ZNode 来做到这一点吗?

I'm wondering to what degree I need to protect my system by making a recurring job that looks for locks that have been around to long and manually releasing them. Would I do that by having my separate process directly delete the relevant ZNode?

推荐答案

Curator 的锁是使用 EPHEMERAL znodes 实现的.所以,如果锁持有者以某种方式变得不稳定,ZooKeeper 应该自动释放锁.如果您正在寻找一种方法来撤销其他进程持有的锁,那么 Curator 的一些锁配方具有协作撤销功能.除此之外,从进程下面删除锁似乎会导致极大的不稳定性.我想不出这样做的充分理由.

Curator's locks are implemented using EPHEMERAL znodes. So, if the lock holder becomes unstable in some way, ZooKeeper should automatically release the lock. If you're looking for a way to revoke locks held by other processes, some of Curator's lock recipes have a cooperative revoking facility. Other than that, deleting a lock from underneath a process seems like it would cause tremendous instability. I can't think of a good reason to do it.

(注:我是策展人的主要作者)

(note: I'm the main author of Curator)

这篇关于Apache Zookeeper/Curator 在锁上的生存时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-18 17:51:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/943737.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间   Apache   Zookeeper   Curator

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!