# zkSample **Repository Path**: xForMe/zkSample ## Basic Information - **Project Name**: zkSample - **Description**: zookeeper的案例 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-12-02 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # zookeeper 入门教程 ## 节点类型 - 持久节点 - 持久顺序节点 - 临时节点 - 临时顺序节点 **创建持久化节点** ``` public static void main(String[] args){ ZkClient zkClient = new ZkClient(Constant.ZK_ADDR,5000); String path = "/zk-book/c1"; //创建持久化节点 zkClient.createPersistent(path,true); } ``` **判断节点是否存在** ``` public static void main(String[] args){ ZkClient zkClient = new ZkClient(Constant.ZK_ADDR,5000); String path = "/zk-book"; //创建持久化节点 Boolean exist = zkClient.exists(path); System.out.println("Node " + path + " exists " + zkClient.exists(path)); } ```