赞
踩
最近打算学习下走zookeeper+dubbo 相关知识,分享一下所遇到的问题,希望可以帮到大家,如还有其他问题请各位大神不吝赐教!
zookeeper在windows 环境下安装与配置步骤:
1.zookeeper下载地址:http://mirrors.hust.edu.cn/apache/zookeeper/,可自行选择版本;
2.下载完成后解压到你要安装的目录,文件目录如图
3.修改配置文件,由于机器数量有限,这里采用伪分布式配置模拟集群配置:
进入到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=/tmp/zookeeper # 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
将内容修改为
# 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=F://zk//temp//zookeeper//server001//data dataLogDir=F://zk//temp//zookeeper//server001/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 server.1=127.0.0.1:8881:7771 server.2=127.0.0.1:8882:7772 server.3=127.0.0.1:8883:7773 server.4=127.0.0.1:8884:7774 server.5=127.0.0.1:8885:7775
ps:参数说明
4.新建伪服务数据存储目录,这里配置了5个伪服务器,so新建5个文件夹分别为server001,server002,server003,server004,server005,再在这5个文件夹下分别新建data和logs文件存储数据文件和日志文件,然后把zookeeper jar包分别放入server00X目录下,之后在每个data文件下新建myid文件txt格式即可,内容分别为1,2,3,4,5,代表服务器下标,命令如下:
echo 1 >> F:\zk\temp\zookeeper-3.4.6\server006\data\myid
执行该命令后可在data目录下找到myid文件,打开内容为1 表示创建成功;改变路径一次在5个data文件下创建myid文件;
5.启动zookeeper服务:
cmd进入到zookeeper安装目录的bin目录下,选择zkServer.cmd 回车启动,也可直接进入到该目录下双击zkServer.cmd启动,如图所示:
启动过程中可能遇到以下情况:
依次改变配置内容启动每个伪服务,到这里zookeeper伪分布式服务器的安装启动已完成;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。