Mac安装配置zookeeper


 

因为有用到 dubbo 这个分布式服务框架,所以去网上看了一些教程。
教程地址,自己一步步跟着做,但是搭建 zookeeper+dubbo-admin 的时候犯了好多错误,特地分享一下。

搭建

  • zookeeper 搭建
    我用的是 zookeeper 3.4.6 版本的。下载下来解压,把 conf 文件夹下的 zoo_sample.cfg 文件重命名为 zoo.cfg,然后修改文件为
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/usr/local/zookeeper-3.4.6/data/ dataLogDir=/usr/local/zookeeper-3.4.6/logs/ # the port at which the clients will connect clientPort=2181 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1 

其中 data 和 logs 是自己新建的文件夹.
启动:cd 到 zookeeper 文件夹下,然后./bin/zkServer.sh start 就启动了,检验启动成功与否,输入命令 jps,出现622 QuorumPeerMain字样就是说明成功了。

  • dubbo-admin 打包
    我自己操作的错误都发生在这里,问题就是 war 不对。
  1. 网上有很多正确的 war 可以下载
  2. 自己去官网下载 dubbo 的源文件,然后自己打包

我启动 zookeeper 之后,再启动 tomcat,发生了很多不一的错误,具体错误信息,我没记录下来,也不准备提,归结于 war 包不对,主要是两种方式不对

  1. mvn install -Dmaven.test.skip=true 这命令的位置不对。正确应该是dubbo-master文件夹下打包,这样就不会缺少依赖,而不是去dubbo-master/dubbo-admin下面打包。
  2. jdk 版本,我的 Mac 是装了两个,1.7 和 1.8,但是我默认是 1.8,导致不对。我切换到 1.7 后就 OK 了。



作者:binbinyouli
链接:https://hacpai.com/article/1501899075701
来源:黑客派
协议:CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0/


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM