博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JEESZ-Zookeeper集群安装
阅读量:7080 次
发布时间:2019-06-28

本文共 3066 字,大约阅读时间需要 10 分钟。

在根目录创建zookeeper文件夹(service1、service2、service3都创建) [root@localhost /]# mkdir zookeeper

通过Xshell上传文件到service1服务器:上传zookeeper-3.4.6.tar.gz到/software文件夹

2.远程copy将service1下的/software/zookeeper-3.4.6.tar.gz到service2、service3

[root@localhost software]# scp -r /software/zookeeper-3.4.6.tar.gz :/software/

[root@localhost software]# scp -r /software/zookeeper-3.4.6.tar.gz :/software/

3.copy /software/zookeeper-3.4.6.tar.gz到/zookeeper/目录(service1、service2、service3都执行)

[root@localhost software]# cp /software/zookeeper-3.4.6.tar.gz /zookeeper/

4.安装解压zookeeper-3.4.6.tar.gz(service1、service2、service3都执行)

[root@localhost /]# cd /zookeeper/

[root@localhost zookeeper]# tar -zxvf zookeeper-3.4.6.tar.gz

5.在/zookeeper创建两个目录:zkdata、zkdatalog(service1、service2、service3都创建)

[root@localhost zookeeper]# mkdir zkdata

[root@localhost zookeeper]# mkdir zkdatalog

6.进入/zookeeper/zookeeper-3.4.6/conf/目录

[root@localhost zookeeper]# cd /zookeeper/zookeeper-3.4.6/conf/

[root@localhost conf]# ls

configuration.xsl log4j.properties zoo.cfg 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=/zookeeper/zkdata

dataLogDir=/zookeeper/zkdatalog

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.

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=192.168.2.211:12888:13888

server.2=192.168.2.212:12888:13888

server.3=192.168.2.213:12888:13888

同步修改service2、service3的zoo.cfg配置 myid文件写入(进入/zookeeper/zkdata目录下)

[root@localhost /]# cd /zookeeper/zkdata

[root@localhost /]# echo 1 > myid

myid文件写入service2、service3

echo 2 > myid

echo 3 > myid

查看zk命令:

[root@localhost ~]# cd /zookeeper/zookeeper-3.4.6/bin/

[root@localhost bin]# ls

README.txt zkCli.cmd zkEnv.cmd zkServer.cmd zookeeper.out

执行zkServer.sh查看详细命令:

[root@localhost bin]# ./zkServer.sh

JMX enabled by default

Using config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg

Usage: ./zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}

在service1、service2、service3分别启动zk服务

[root@localhost bin]# ./zkServer.sh start

jps查看zk进程

[root@localhost bin]# jps

31483 QuorumPeerMain

31664 Jps

分别在service1、service2、service3查看zk状态(可以看到leader和follower节点)

[root@localhost bin]# ./zkServer.sh status

JMX enabled by default

Using config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg

Mode: follower

[root@localhost bin]# ./zkServer.sh status

JMX enabled by default

Using config: /zookeeper/zookeeper-3.4.6/bin/../conf/zoo.cfg

Mode: leader

看到leader和follower节点已经安装成功

转载地址:http://qdvml.baihongyu.com/

你可能感兴趣的文章
CloudPlatform和CloudStack的关系
查看>>
4-26 pixel赋值问题 mbcmp函数 宏定义
查看>>
44 MySQL & orm对象关系映射
查看>>
indexOf 可用于字符串和数组
查看>>
ThinkPHP5.0的安装
查看>>
SpringBoot数据库读写分离之基于Docker构建主从数据库同步实例
查看>>
收获与体会
查看>>
dev/null和dev/zero区别 以及换回设备(loopback device)
查看>>
You have not concluded your merge. (MERGE_HEAD exists)。(转)
查看>>
LeetCode - 13. Roman to Integer
查看>>
Java多线程系列--“JUC集合”05之 ConcurrentSkipListMap
查看>>
七牛上传
查看>>
7.6日总结
查看>>
mysql索引
查看>>
BZOJ1004[HNOI2008]Cards——polya定理+背包
查看>>
[Unity] Shader - CG语言 流程控制语句
查看>>
转载--PHP json_encode() 和json_decode()函数介绍
查看>>
pdo中query()与prepare().execute()
查看>>
strong retain copy对于 nsstring,nsmutablestring的区别
查看>>
二维数组
查看>>