在三台Centos或Windows中部署三台Zookeeper集群配置

摘要:
本文中解压到/opt目录下。二、环境1、三台服务器IP分别为:192.168.1.104、192.168.1.105、192.168.1.1062、三台的Zookeeper配置文件路径都是:/opt/zookeeper/zookeeper-3.4.13/conf/zoo.cfg三、配置集群:1、服务器192.168.1.104中:修改/opt/zookeeper/zookeeper-3.4.13/conf/zoo.cfg文件内容如下:#ThenumberofmillisecondsofeachticktickTime=2000#Thenumberofticksthattheinitial#synchronizationphasecantakeinitLimit=10#Thenumberofticksthatcanpassbetween#sendingarequestandgettinganacknowledgementsyncLimit=5#thedirectorywherethesnapshotisstored.#donotuse/tmpforstorage,/tmphereisjust#examplesakes.dataDir=/opt/zookeeper/zkdata/datadataLogDir=/opt/zookeeper/zkdata/log#theportatwhichtheclientswillconnectclientPort=2181#themaximumnumberofclientconnections.#increasethisifyouneedtohandlemoreclients#maxClientCnxns=60##Besuretoreadthemaintenancesectionofthe#administratorguidebeforeturningonautopurge.##http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance##ThenumberofsnapshotstoretainindataDir#autopurge.snapRetainCount=3#Purgetaskintervalinhours#Setto"0"todisableautopurgefeature#autopurge.purgeInterval=1server.104=0.0.0.0:2888:3888server.105=192.168.6.105:2888:3888server.106=192.168.6.106:2888:3888创建目录并配置myid。

一、安装包

1、下载最新版(3.4.13):https://archive.apache.org/dist/zookeeper/ 下载https://archive.apache.org/dist/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz解压开即可。本文中解压到/opt目录下。

二、环境

1、三台服务器IP分别为:192.168.1.104、192.168.1.105、192.168.1.106

2、三台的Zookeeper配置文件路径都是:/opt/zookeeper/zookeeper-3.4.13/conf/zoo.cfg

三、配置集群:

1、服务器192.168.1.104中:

(1)修改/opt/zookeeper/zookeeper-3.4.13/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 isstored.
# do not use /tmp for storage, /tmp here isjust 
# example sakes.
dataDir=/opt/zookeeper/zkdata/data
dataLogDir=/opt/zookeeper/zkdata/log
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this ifyou 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 indataDir
#autopurge.snapRetainCount=3
# Purge task interval inhours
# Set to "0"to disable auto purge feature
#autopurge.purgeInterval=1
server.104=0.0.0.0:2888:3888
server.105=192.168.6.105:2888:3888
server.106=192.168.6.106:2888:3888

(2)创建目录并配置myid。

I、创建目录:/opt/zookeeper/zkdata/data

II、创建文件:/opt/zookeeper/zkdata/data/myid ,内容为"104" ,或者使用命令快速生成:

echo 104>/opt/zookeeper/zkdata/data/myid

2、服务器192.168.1.105中:

(1)修改/opt/zookeeper/zookeeper-3.4.13/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 isstored.
# do not use /tmp for storage, /tmp here isjust 
# example sakes.
dataDir=/opt/zookeeper/zkdata/data
dataLogDir=/opt/zookeeper/zkdata/log
# the port at which the clients will connect
clientPort=2181# the maximum number of client connections.
# increase this ifyou 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 indataDir
#autopurge.snapRetainCount=3# Purge task interval inhours
# Set to "0"to disable auto purge feature
#autopurge.purgeInterval=1
server.104=192.168.6.104:2888:3888
server.105=0.0.0.0:2888:3888
server.106=192.168.6.106:2888:3888

(2)创建目录并配置myid。

I、创建目录:/opt/zookeeper/zkdata/data

II、创建文件:/opt/zookeeper/zkdata/data/myid ,内容为"105" ,或者使用命令快速生成:

echo 105>/opt/zookeeper/zkdata/data/myid

3、服务器192.168.1.106中:

(1)修改/opt/zookeeper/zookeeper-3.4.13/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=/opt/zookeeper/zkdata/data
dataLogDir=/opt/zookeeper/zkdata/log
# 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
server.104=192.168.6.104:2888:3888
server.105=192.168.6.105:2888:3888
server.106=0.0.0.0:2888:3888

(2)创建目录并配置myid。

I、创建目录:/opt/zookeeper/zkdata/data

II、创建文件:/opt/zookeeper/zkdata/data/myid ,内容为"106" ,或者使用命令快速生成:

echo 106>/opt/zookeeper/zkdata/data/myid

四、三台机器中,都为防火墙中添加2181、2888、3888端口入站。

添加端口:
  firewall-cmd --zone=public --add-port=2181/tcp --permanent
  firewall-cmd --zone=public --add-port=2888/tcp --permanent
  firewall-cmd --zone=public --add-port=3888/tcp --permanent
重新载入:
  firewall-cmd --reload

五、启动Zookeeper:三台机器中依次运行

/opt/zookeeper/zookeeper-3.4.13/bin/zkServer.sh start /opt/zookeeper/zookeeper-3.4.13/conf/zoo.cfg

免责声明:文章转载自《在三台Centos或Windows中部署三台Zookeeper集群配置》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇XMLHTTP使用具体解释H5网页适配 iPhoneX,就是这么简单下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

.Net Core 商城微服务项目系列(十三):搭建Log4net+ELK+Kafka日志框架

之前是使用NLog直接将日志发送到了ELK,本篇将会使用Docker搭建ELK和kafka,同时替换NLog为Log4net。 一.搭建kafka 1.拉取镜像 //下载zookeeper docker pull wurstmeister/zookeeper //下载kafka docker pull wurstmeister/kafka:2.11-...

Linux学习4-阿里云服务器(CentOS)下使用 Tomcat安装 Jenkins

前言 通常做自动化测试,需要用到jenkins来做持续集成,那么linux系统里面如何使用tomcat安装Jenkins环境呢? 前面一篇已经搭建好java和tomcat环境,接着直接下载jenkins的war包放到tomcat下就能部署了。 环境准备: 1.一台Linux服务器, 操作系统: CentOS 7.4 64位 2.Xshell 5.0 3.j...

下载 CentOS 7 镜像文件

CentOS 7 镜像文件的下载地址 CentOS 官网:https://www.centos.org/ 点击“Get CentOS Now” 点击想要下载的ISO镜像,(目前仅有“DVD ISO”和“Minimal ISO”, 以前还有“Everything ISO”;DVD、Minimal、Everything这个概念类似windows有家庭版、企...

Centos(64位)安装Hbase详细步骤

HBase是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System)所提供的分布式数据存储一样,HBase在Hadoop之上提供了类似于Bigtable的能力。HBase是Apache的Hadoo...

CentOS中TFTP配置

转载:http://www.centoscn.com/image-text/config/2013/1105/2062.html TFTP是用来下载远程文件的最简单网络协议,它其于UDP协议而实现 1.安装软件 yum install tftp* 安装好tftp-server包, 需要把/etc/xinetd.d/tftp文件做一下几个修改。 2.修改启动...

zookeeper集群(linux)和单机(windows)搭建

Zookeeper集群(linxu)搭建 环境要求:必须要有jdk环境,本次讲课使用jdk1.8 3.1结构 一共三个节点集群的服务器数量一般为2n+1个,(zk服务器集群规模不小于3个节点),要求服务器之间系统时间保持一致。 3.2上传zk并且解压进行解压: tar -zxvf zookeeper-3.4.6.tar.gz重命名: mv zookeep...