下面是我搭建使用的版本:
ant :apache-ant-1.10.5-bin.zipjdk1.8 :jdk-8u144-windows-x64 [~]$ ant -version Apache Ant(TM) version 1.10.6 compiled on May 2 2019切换到zookeeper目录下,使用 ant 编译,命令 ant eclipse
[apache-zookeeper-3.5.5]$ ant eclipse编译成功后:
[ivy:cachepath] :: resolution report :: resolve 696ms :: artifacts dl 109ms --------------------------------------------------------------------- | | modules || artifacts | | conf | number| search|dwnlded|evicted|| number|dwnlded| --------------------------------------------------------------------- | test | 53 | 0 | 0 | 0 || 53 | 0 | --------------------------------------------------------------------- [eclipse] Writing the preferences for "org.eclipse.jdt.core". [eclipse] Writing the preferences for "org.eclipse.core.resources". [eclipse] Writing the project definition in the mode "java". [eclipse] Writing the classpath definition. BUILD SUCCESSFUL Total time: 54 seconds [apache-zookeeper-3.5.5]$编辑器使用的idea; 用eclipse模式导入; 导入后添加 maven框架;
因为provided 报错:
2019-05-26 09:43:51,618 [myid:3] - WARN [main:AdminServerFactory@58] - Unable to load jetty, not starting JettyAdminServer java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Connector 修改conf/zoo.cfg tickTime=2000 initLimit=10 syncLimit=5 dataDir=D:/temp/zk dataLogDir=D:/temp/zk/datalog clientPort=2181 把zooleeper-server下的resources目录作为资源目录(source root);把conf下log4j.properties,复制到resources下; 备注:非必须,有了可以看日志运行服务器 QuorumPeerMain 主程序: org.apache.zookeeper.server.quorum.QuorumPeerMain 添加程序一个参数 conf/zoo.cg