linux(centos)下zookeeper安装和配置
程序员文章站
2022-05-31 11:01:32
...
zookeeper安装
cd /tmp
wget http://mirror.bit.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
sudo su
mkdir /opt/yourpath/
tar xvf zookeeper-3.4.11.tar.gz -C /opt/yourpath/
cd /opt/yourpath/
mv zookeeper-3.4.11/ zookeeper
cd zookeeper
mkdir data
mkdir log
myid文件
data目录下新建myid文件,写入一个id(在ip上取一个不同的值,区分开,这个值会和下面的zoo.cfg的一个值有关)
[[email protected] data]# pwd
/opt/interlive/yourpath/data
[[email protected] data]# cat myid
179
zoo.cfg文件
conf目录下,新建zoo.cfg文件,写入配置,参考之前的配置。
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=/opt/interlive/zookeeper/data
dataLogDir=/opt/interlive/zookeeper/log
# the port at which the clients will connect
clientPort=2181
server.179=10.0.100.179:2888:3888
server.180=10.0.100.180:2888:3888
server.181=10.0.100.181:2888:3888
# the maximum number of client connections.
# increase this if you need to handle more clients
maxClientCnxns=0
#
# 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=10
# Purge task interval in hours
# Set to "0" to disable auto purge feature
autopurge.purgeInterval=4
启动
/bin/yum install java
cd /opt/interlive/zookeeper/bin
./zkServer.sh start
建立节点
cd /opt/yourpath/zookeeper/bin
./zkCli.sh -server 10.0.100.179:2181;10.0.100.180:2181;10.0.100.181:2181
create /online "online"
create /online/yournode "yournode"
create /online/yournode/yournodesub "yournodesub"
查看节点
ls /
ls /online
参考
http://coolxing.iteye.com/blog/1871009
http://www.tuicool.com/articles/Y3eame
推荐阅读
-
CentOS7下mysql 8.0.16 安装配置方法图文教程
-
Linux虚拟机下mysql 5.7安装配置方法图文教程
-
Centos7下mysql 8.0.15 安装配置图文教程
-
Linux下mysql 8.0.15 安装配置图文教程以及修改密码
-
CentOS7下MySQL5.7安装配置方法图文教程(YUM)
-
Linux系统:centos7下搭建ZooKeeper3.4中间件,常用命令总结
-
linux安装vsftpd和vsftpd配置步骤
-
Win10下免安装版MySQL8.0.16的安装和配置教程图解
-
Linux系统下 MySQL 安装 指南(5.7和8.0 版本)
-
Linux centos7环境下MySQL安装教程