[ZooKeeper]常见的KeeperException

本文详细介绍了ZooKeeper客户端操作中可能出现的各种异常情况及其原因,包括节点存在、节点不存在、版本错误等异常,并针对每种操作(如create、delete等)提供了具体的异常类型说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

常见的KeeperException里,Connectionloss异常通常是可以忽略的,authfailed和session expired异常要求重新创建zookeeper客户端。其他种类的异常,根据实际业务逻辑来处理。

ZooKeeper.create 

NodeExistsException NODEEXISTS - if a node with the same actual path already exists
NoNodeException NONODE - if the parent node does not exist
NoChildrenForEphemeralsException NOCHILDRENFOREPHEMERALS - if the parent node of the given path is ephemeral
InvalidACLException INVALIDACL - if the ACL is invalid, null, or empty
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.delete

NoNodeException NONODE - if the nodes does not exist
BadVersionException BADVERSION - if the given version does not match the node's version
NotEmptyException NOTEMPTY - if the node has children
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.multi

AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.exists

AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.getData

NodeExistsException NODEEXISTS - if no node with the given path exists
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.setData

NodeExistsException NODEEXISTS - if no node with the given path exists
BadVersionException BADVERSION - if the given version does not match the node's version
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.getACL

NodeExistsException NODEEXISTS - if no node with the given path exists
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.setACL

NodeExistsException NODEEXISTS - if no node with the given path exists
BadVersionException BADVERSION - if the given version does not match the node's version
InvalidACLException INVALIDACL - if the ACL is invalid
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS


ZooKeeper.getChildren
NodeExistsException NODEEXISTS - if no node with the given path exists
AuthFailedException AUTHFAILED
SessionExpiredException SESSIONEXPIRED
ConnectionLossException CONNECTIONLOSS
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值