Zookeeper实例ZkClient API-创建节点
来源:互联网 发布:微商代理授权 源码 编辑:程序博客网 时间:2024/06/01 07:56
import org.I0Itec.zkclient.ZkClient;/** * * @ClassName: Create_Node_Sample * @Description: TODO(使用ZkClient创建节点) * @author * @date 2017年6月14日 下午12:49:54 * */public class Create_Node_Sample { public static void main(String[] args) throws Exception { ZkClient zkClient = new ZkClient("localhost:2181", 5000); String path = "/zk-book/c1"; zkClient.createPersistent(path, true); }}
注意:
ZkClient提供了较多的创建节点API接口,其中不同的地方是可以传递对象,和原生的Zookeeper不同。ZkClient通过createParents这个参数,ZkClient能够在内部帮助我们递归建立父节点。
扩展
参考
1.《从Paxos到Zookeeper:分布式一致性原理与实践》
2. http://javadox.com/com.101tec/zkclient/0.4/org/I0Itec/zkclient/ZkClient.html
阅读全文
1 0
- Zookeeper实例ZkClient API-创建节点
- Zookeeper实例ZkClient API-删除节点
- Zookeeper实例ZkClient API-更新节点内容
- Zookeeper实例ZkClient API-创建一个Zookeeper客户端
- Zookeeper实例ZkClient API-获取子节点列表
- Zookeeper实例ZkClient API-获取节点数据内容
- Zookeeper实例ZkClient API-检查节点是否存在
- Zookeeper实例原生API--同步创建节点
- Zookeeper实例原生API--异步创建节点
- Zookeeper API 和 Zkclient
- ZkClient之创建节点。
- Zookeeper实例Curator API-使用Curator创建节点
- zookeeper zkclient API小案例
- Zookeeper原生API-ZkClient-Curator对比
- Zookeeper实例原生API--删除节点
- Zookeeper实例Curator API-NodeCache节点不存在实例
- Zookeeper实例原生API--创建一个基本的Zookeeper会话
- Zookeeper实例原生API--同步获取子节点列表
- 外围设备单独编址时,访问内存和访问I/O设备使用不同操作码的指令
- 推导基姆拉尔森公式根据日期计算星期
- 重复工作到底有没有意义
- 推导基姆拉尔森公式根据日期计算星期
- SpringBoot入门
- Zookeeper实例ZkClient API-创建节点
- 下载POI信息点(学校、医院、银行、餐饮等等)
- Kotlin学习途径
- Glide加载https图片
- Android Studio之Instant Run requires 'Tools | Android | Enable ADB integration' to be enabled解决办法
- 第四章SpringMVC--Controller接口控制器详解 (4)
- NTT(快速数论变换)模板
- 如何提高UI设计效率
- 17. Letter Combinations of a Phone Number