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

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

hot3.png

一、Zookeeper下载

wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz

二、Zookeeper解压

tar -zxvf  /usr/program/zookeeper/zookeeper-3.4.9.tar.gz

三、进入conf目录

cd /usr/program/zookeeper/zookeeper-3.4.9/conf

拷贝zoo_sample.cfg为zoo.cfg

cp zoo_sample.cfg zoo.cfg

编辑zoo.cfg

vim zoo.cfg

配置成下面的样子

# The number of milliseconds of each ticktickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.dataDir=/usr/program/zookeeper/zookeeper-3.4.9/data# the directory stored data logdataLogDir=/usr/program/zookeeper/zookeeper-3.4.9/log# the port at which the clients will connectclientPort=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# service configserver.1=192.168.239.131:2888:3888

四、设置环境变量

export ZOOKEEPER_INSTALL=/usr/program/zookeeper/zookeeper-3.4.9

export PATH=$PATH:$ZOOKEEPER_INSTALL/bin

export PATH=$PATH:$ZOOKEEPER_INSTALL/conf

进入/etc目录下,用source profile命令使它生效

五、启动

./zkServer.sh start

六、测试

./zkCli.sh -server 192.168.239.131:2181

---->>>集群配置<<<---

将zoo.cfg的service配置如下

server.1=192.168.239.131:2888:3888server.2=192.168.239.130:2888:3888server.3=192.168.239.132:2888:3888

在zoo.cfg配置dataDir对应的目录下创建myid文件,并在对应的机器上输入1、2、3(如:server.1这台机输入1,server.2这台机输入2,server.3这台机输入3)

使用打印日志的方式启动

./zkServer.sh start-foreground(使用这种方式启动,如果按Ctrl+Z退出日志查看,服务就会挂掉,还不清楚为什么!)

使用下面命令查看启动信息

./zkServer.sh status

ZooKeeper JMX enabled by defaultUsing config: /usr/program/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfgMode: leader

 

转载于:https://my.oschina.net/u/3233100/blog/1545499

你可能感兴趣的文章
测试用例的代码复用
查看>>
国内一些大公司的开源项目
查看>>
Redis学习笔记(5)-Set
查看>>
两种查找bapi的方法
查看>>
事件监听
查看>>
【总结整理】AXURE原件
查看>>
Django Ajax
查看>>
Lua不显示小数点0的部分
查看>>
【前台 乱码】 前台单独乱码+后台往前台传输的数据乱码
查看>>
性能分析
查看>>
使用gdaldem生成山体阴影——thematicmapping.org译文(二)
查看>>
Hello CnBlog
查看>>
第十周学习进度条
查看>>
第二次团队冲刺第九天
查看>>
jQuery函数attr()和prop()的区别
查看>>
目录可执行的含义
查看>>
idea springboot 使用JRebel热部署
查看>>
Java中的集合框架
查看>>
java.lang.ClassNotFoundException: org.springframework.web.filter.CharacterEncodingFilter
查看>>
rapid_generator uml
查看>>