ZooKeeper安装过程
来源:互联网 发布:php进销存源码erp 编辑:程序博客网 时间:2024/05/01 07:34
0.首先安装jdk
1.Zookeeper下载:http://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/
2.解压安装:tar -zxvf zookeeper-3.4.5.tar.gz 生成zookeeper-3.4.5目录
3.进入conf中,cp zoo_sample.cfg zoo.cfg
4.修改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
dataDir=/usr/local/app/zookeeper-3.4.5/data
# the port at which the clients will connect
clientPort=2181
#
# 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
#master为192.168.70.115
#slave1 192.168.70.116
#slave2 192.168.70.117
#2881是各zookeeper服务器之间通信端口
#3881是zookeeper与其它应用程序之间的通信端口
#端口都是可以自定义的,非固定
server.1=192.168.70.115:2881:3881
server.2=192.168.70.116:2881:3881
server.3=192.168.70.117:2881:3881
3.4.6版本需要在dataDir中创建myid文件,内容分别是1/2/3,最大255
5.三台机器分别配置jdk-Zookeeper-zoo.cfg后,在所有机器上分别启动 bin/zkServer.sh start
[root@hadoop2 zookeeper-3.4.5]# bin/zkServer.sh start
JMX enabled by default
Using config: /usr/local/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@hadoop2 zookeeper-3.4.5]# jps
15985 Jps
15959 QuorumPeerMain
启动成功。
6.leader服务器
[root@hadoop3 bin]# ./zkServer.sh status
JMX enabled by default
Using config: /usr/local/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: leader
后面启动的是slave
[root@hadoop1 bin]# ./zkServer.sh status
JMX enabled by default
Using config: /usr/local/app/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: follower
当我们起第二个zookeeper实例后,leader将会被选出,从而一致性服务开始可以使用,这是因为3台机器只要有2台可用就可以选出leader并且对外提供服务(2n+1台机器,可以容n台机器挂掉)
7.客户端链接
[zk: localhost:2181(CONNECTED) 1] ls
ZooKeeper -server host:port cmd args
connect host:port
get path [watch]
ls path [watch]
set path data [version]
rmr path
delquota [-n|-b] path
quit
printwatches on|off
create [-s] [-e] path data acl
stat path [watch]
close
ls2 path [watch]
history
listquota path
setAcl path acl
getAcl path
sync path
redo cmdno
addauth scheme auth
delete path [version]
setquota -n|-b val path
[zk: localhost:2181(CONNECTED) 2] ls /
[zookeeper]
[zk: localhost:2181(CONNECTED) 3]
- ZooKeeper安装过程
- ZooKeeper安装过程
- ZooKeeper安装过程
- ZooKeeper安装过程
- ZooKeeper安装过程 .
- ZooKeeper安装过程
- ZooKeeper安装过程
- ZooKeeper安装过程
- zookeeper安装过程
- zookeeper安装过程
- zookeeper安装过程
- Ubuntu下ZooKeeper安装过程
- zookeeper简介与安装过程
- Ubuntu下ZooKeeper安装过程
- Zookeeper安装过程中的坑
- Zookeeper集群环境安装过程详解
- ZooKeeper 3.4.5 安装出错过程记录
- Zookeeper集群环境安装过程详解
- oracle之rman恢复spfile练习
- c++ 虚析构函数
- 来自MIT人工智能实验室:如何做研究
- Outlook邮箱处理
- OpenNI 2.x与Kinect For Windows的安装
- ZooKeeper安装过程
- resignfirstresponder
- Java IO流学习总结
- linux创建读写文件
- Android开发(4)Android电话拨号器
- linux进程通信---几个发送信号的函数(kill,raise,alarm,pause)
- DIV层的五条叠加法则
- Android开发(5)--对应用进行单元测试
- 设置APP加载页面