1 首先要安装jdk;
2 安装zookeeper,下载地址http://www.apache.org/dist/zookeeper/
3 然后在对应的zookeeper-3.4.6/conf 下有一个文件zoo_sample.cfg的这个文件里面配置了监听客户端连接的端口等一些信息,Zookeeper 在启动时会找zoo.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. dataDir=/tmp/zookeeper # the port at which the clients will connect clientPort=2181
如果/tmp/zookeeper目录不存在,要创建
默认端口 2181;
进入zookeeper安装目录下的bin目录,我的是/usr/dubbo/zookeeper-3.3.6/bin
执行 ./zkServer.sh start 启动;
[root@bogon bin]# netstat -unltp|grep 2181 tcp 0 0 :::2181 :::* LISTEN 5474/java
启动成功;
./zkServer.sh stop 关闭
