深入浅出Zookeeper之一Server启动
来源:互联网 发布:ios 本地存储数组 编辑:程序博客网 时间:2024/06/05 00:22
大名鼎鼎的Zookeeper是解决分布式问题的神器。小编最近简单阅读了代码,分享一下。有不对之处,还请大家指出。
整篇文章将分多个系列完成,因为涉及点比较多,很难在一片文章内搞定。关于zookeeper的使用场景,大家参考http://rdc.taobao.com/team/jm/archives/1232。api使用参考官网手http://zookeeper.apache.org/doc/trunk/。这里以最新的zookeeper3.4.5为例。
这个系列的第一篇来说说zookeeper server端的启动,以单机为例,分布式zookeeper将在后续专门分析。
单机版启动类ZooKeeperServerMain
- protected void initializeAndRun(String[] args)
- throws ConfigException, IOException
- {
- try {
- ManagedUtil.registerLog4jMBeans();
- } catch (JMException e) {
- LOG.warn("Unable to register log4j JMX control", e);
- }
- //解析配置文件zoo.cfg
- ServerConfig config = new ServerConfig();
- if (args.length == 1) {
- config.parse(args[0]);
- } else {
- config.parse(args);
- }
- //启动
- runFromConfig(config);
- }
protected void initializeAndRun(String[] args) throws ConfigException, IOException { try { ManagedUtil.registerLog4jMBeans(); } catch (JMException e) { LOG.warn("Unable to register log4j JMX control", e); }//解析配置文件zoo.cfg ServerConfig config = new ServerConfig(); if (args.length == 1) { config.parse(args[0]); } else { config.parse(args); }//启动 runFromConfig(config); }
具体解析:
- public void parse(String path)throws ConfigException {
- QuorumPeerConfig config = new QuorumPeerConfig();
- config.parse(path);
- // let qpconfig parse the file and then pull the stuff we are
- // interested in
- readFrom(config);
- }
- 深入浅出Zookeeper之一Server启动
- Zookeeper源码分析之一Server启动
- # zookeeper 单机版server启动
- zookeeper源码分析之一启动过程
- 深入浅出Zookeeper
- Zookeeper深入浅出
- 深入浅出Netty之二 server启动
- Zookeeper源码解析之Server启动
- kafka源码分析之一server启动分析
- ZooKeeper之深入浅出概述
- ZooKeeper系列之一:ZooKeeper简介
- ZooKeeper系列之一:ZooKeeper简介
- ZooKeeper系列之一:ZooKeeper简介
- ZooKeeper系列之一:ZooKeeper简介
- ZooKeeper系列之一: Zookeeper 介绍
- Zookeeper-Zookeeper启动过程
- Zookeeper-Zookeeper启动过程
- Zookeeper-Zookeeper启动过程
- java网络编程--网络模型概述
- 第一周JAVA学习总结
- spring+struts2+dwr
- HDOJ 1097 A hard puzzle
- VirtualKD+Windbg+vmware 极速调试+Windbg下载符号+windows 7本地内核调试
- 深入浅出Zookeeper之一Server启动
- [技巧]设置中文文件编码和本地JDK
- MySQL 5.5 keepalived + haproxy + MHA 自动容灾
- 在eclipse 设置编辑区、控制台、xml等文本文件字体大小
- Spring --- Transaction Management
- Java数据类型
- 开源了我的xPrintf和TinyShell项目源码并发布到GitHub上
- 开源 免费 java CMS - FreeCMS-功能说明-模板管理 .
- 高级并发对象(Councurrency Tutorial 7)