Zookeeper, Znode 介绍:
https://blog.csdn.net/dslztx/article/details/51077606
CuratorFramework
https://blog.csdn.net/u010889616/article/details/80209629

Java使用CuratorFramework ,删除Znode

public class ZookeeperManager {

    private static CuratorFramework client;
    
    public static CuratorFramework getZookeeperClient() {
        return client;
    }

这样只能删一个Znode,如果底下有子节点就删不掉了

ZookeeperManager.getZookeeperClient().delete().forPath(endpointPath);

这样才能删一个Znode和这个Znode下的所有子节点

ZookeeperManager.getZookeeperClient().delete().deletingChildrenIfNeeded().forPath(endpointPath);
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐