云服务器搭建六:linux安装Zookeeper

2019-07-25  本文已影响0人  蜻蜓队长家长

linux安装Zookeeper

ZooKeeper是一种集中式服务,用于维护配置信息,命名,提供分布式同步和提供组服务。所有这些类型的服务都以分布式应用程序的某种形式使用。每次实施它们都需要做很多工作来修复不可避免的错误和竞争条件。由于难以实现这些类型的服务,应用程序最初通常会吝啬它们,这使得它们在变化的情况下变得脆弱并且难以管理。即使正确完成,这些服务的不同实现也会在部署应用程序时导致管理复杂性。

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

tar -zxvf apache-zookeeper-3.5.5-bin.tar.gz
#进入到conf目录
cd apache-zookeeper-3.5.5-bin/conf
#拷贝zoo_samle.cfg为zoo.cfg
cp zoo_sample.cfg zoo.cfg
vim /usr/local/apache-zookeeper-3.5.5-bin/conf/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=/usr/local/apache-zookeeper-3.5.5-bin/tmp/zookeeper
# 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.
#
# 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
export ZOOKEEPER_HOME=/usr/local/apache-zookeeper-3.5.5-bin
export PATH=$ZOOKEEPER_HOME/bin:$PATH

或者编辑 vim ~/.bashrc 文本,写入以上变量,然后使用 source ~/.bashrc 生效

/usr/local/apache-zookeeper-3.5.5-bin/bin/zkServer.sh start
/usr/local/apache-zookeeper-3.5.5-bin/bin/zkServer.sh status
/usr/local/apache-zookeeper-3.5.5-bin/bin/zkServer.sh stop

2.出现Starting zookeeper ... FAILED TO START


因为apache-zookeeper-3.5.5.tar.gz为源码包,未进行编译打包
解决方案
1.配置maven环境 执行maven clean install进行打包
2.直接下载apache-zookeeper-3.5.5-bin.tar.gz使用
上一篇 下一篇

猜你喜欢

热点阅读