一、源码编译
编译zookeeper源码
1:ant eclipse
2:将bulild.xml中的(1900多行的地方)
get src="http://downloads.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2"
替换成如下地址
get src="http://ufpr.dl.sourceforge.net/project/ant-eclipse/ant-eclipse/1.0/ant-eclipse-1.0.bin.tar.bz2"
3: import project 选择eclipse
4:
tickTime=2000000
initLimit=10
syncLimit=5
dataDir=F:\\lry\\project\\zookeeper-release-3.4.14\\data
dataLogDir=F:\\lry\\project\\zookeeper-release-3.4.14\\log
clientPort=2181
5:vm options:-Dlog4j.configuration=file:F:\lry\project\zookeeper-release-3.4.14\conf\log4j.properties
6:program argu : F:\lry\project\zookeeper-release-3.4.14\conf\zoo.cfg
7:
package org.apache.zookeeper.version;
public interface Info {
int MAJOR=1;
int MINOR=0;
int MICRO=0;
String QUALIFIER=null;
int REVISION=-1; //TODO: remove as related to SVN VCS
String REVISION_HASH="1";
String BUILD_DATE="2019-3-4";
}
二、启动流程
ps: 启动类是ZookeeperServerMain
main函数
解析jvm参数,拿到zoo.cfg的路径,解析配置文件
代码是我根据源码改的,方便截图
设置请求处理链:prep-> sync -> final