centos7.0配置zookeeper环境


1.选择zookeeper文件夹

安装的时候选择的是/usr/local目录,根据个人情况而定

2.下载zookeeper文件压缩包

wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz

3.解压压缩包到当前目录

tar -zxvf zookeeper-3.4.9.tar.gz

4.重命名目录文件(可以不改)

mv zookeeper-3.4.9\ zookeeper

5.复制zookeeper配置文件并重命名zoo.cfg

cd zookeeper/conf/
cp zoo_sample.cfg zoo.cfg

6.修改zoo.cfg文件

vim zoo.cfg
 
 

# The number of milliseconds of each tick

 
 

# zookeeper 定义的基准时间间隔,单位:毫秒
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/zookeeper/data

# 日志文件夹
dataLogDir=/usr/local/zookeeper/logs

# the port at which the clients will connect


# 客户端访问 zookeeper 的端口号
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.
#
# 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

:wq保存退出

7.增加zookeeper环境变量

#修改环境变量文件
vim /etc/profile 
#后面增加zookeeper变量
export ZOOKEEPER_INSTALL=/usr/local/zookeeper/
export PATH=$PATH:$ZOOKEEPER_INSTALL/bin
export PATH

:wq保存退出

8.使环境变量生效

source /etc/profile

9.启动zookeeper服务

cd /usr/local/bin
#启动服务器
./skServer.sh start

10.查询zookeeper服务

zkServer.sh status

11.查询zookeeper进程

jps

其中QuorumPeerMain是属于zookeeper的进程,表示zookeeper服务已经正常启动

12.安装过程中的出现的问题

12.1出现启动成功,但是进程没有启动

./zkServer.sh start-foreground  #启动过程中加入参数详细输出

提示找不到class org.apache.zookeeper.server.quorum.QuorumPeerMain类方法

zookeeper启动需要依赖java环境,将java环境添加到/etc/profile文件内

echo $JAVA_HOME

出现java版本说明java环境正常,如果还存在找不到类方法就重新下载一个zookeeper版本

 文章参考地址:https://www.cnblogs.com/huangjianping/p/8012580.html


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM