centos 安装zookeeper

前端之家收集整理的这篇文章主要介绍了centos 安装zookeeper前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

环境:centos7

先安装jdk: http://www.jb51.cc/article/p-abkqqjpz-bpw.html

zookeeper下载地址:http://apache.fayea.com/zookeeper/stable/zookeeper-3.4.10.tar.gz

下载
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget http://apache.fayea.com/zookeeper/stable/zookeeper-3.4.10.tar.gz

解压,移动
[root@localhost src]# tar -zxvf zookeeper-3.4.10.tar.gz
[root@localhost src]# mv zookeeper-3.4.10 ../zookeeper

配置zk
[root@localhost local]# cd ../zookeeper/conf
配置模版文件zoo_sample.cfg,拷贝一份出来
[root@localhost conf]# cp zoo_sample.cfg zoo.cfg

进入bin文件
[root@localhost conf]# cd ../bin

有日志启动,关掉就没了
[root@localhost bin]# ./zkServer.sh start-foreground
后台启动
[root@localhost bin]# ./zkServer.sh start

开启客户端
[root@localhost bin]# ./zkCli.sh -server 127.0.0.1:2181

能正确开启客户端就是安装成功了

三种部署方式:
单机:
上面图片最后没加上
server.1=192.168.2.158:2888:3888
dataDir的目录下加上myid文件,里面内容只有1,就是这个服务server.1的这个1

伪集群:
server.1=192.168.2.158:2888:3888
server.2=192.168.2.158:2888:3888
server.3=192.168.2.158:2888:3888

集群:
server.1=192.168.2.158:2888:3888
server.2=192.168.2.135:2888:3888
server.3=192.168.2.161:2888:3888

检验集群是否正常,使用
telnet 192.168.2.158 2181

[root@localhost bin]# telnet 192.168.2.158 2181
Trying 192.168.2.158…
Connected to 192.168.2.158.
Escape character is ‘^]’.

stat
Zookeeper version: 3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f,built on 03/23/2017 10:13 GMT
Clients:
/192.168.2.158:419760

Latency min/avg/max: 0/0/0 Received: 1 Sent: 0 Connections: 1 Outstanding: 0 Zxid: 0x100000002 Mode: follower (类型,还有leader等,以后说明) Node count: 4 Connection closed by foreign host.

原文链接:https://www.f2er.com/centos/376128.html

猜你在找的CentOS相关文章