浅墨散人 浅墨散人
  • 基础
  • 设计模式
  • JVM
  • Maven
  • SpringBoot
  • 基础
  • Flask
  • Diango
  • Pandas
  • SqlAlchemy
  • Sqoop
  • Flume
  • Flink
  • Hadoop
  • Hbase
  • Hive
  • Kafka
  • Kylin
  • Zookeeper
  • Tez
  • MySQL
  • Doris
  • Chrome
  • Eclipse
  • IDEA
  • iTerm2
  • Markdown
  • SublimeText
  • VirtualBox
  • WebStrom
  • Linux
  • Mac
  • Hexo
  • Git
  • Vue
  • VuePress
  • 区块链
  • 金融
数据仓库
数据治理
读书笔记
关于我
GitHub (opens new window)
  • 基础
  • 设计模式
  • JVM
  • Maven
  • SpringBoot
  • 基础
  • Flask
  • Diango
  • Pandas
  • SqlAlchemy
  • Sqoop
  • Flume
  • Flink
  • Hadoop
  • Hbase
  • Hive
  • Kafka
  • Kylin
  • Zookeeper
  • Tez
  • MySQL
  • Doris
  • Chrome
  • Eclipse
  • IDEA
  • iTerm2
  • Markdown
  • SublimeText
  • VirtualBox
  • WebStrom
  • Linux
  • Mac
  • Hexo
  • Git
  • Vue
  • VuePress
  • 区块链
  • 金融
数据仓库
数据治理
读书笔记
关于我
GitHub (opens new window)
  • Zookeeper

    • Zookeeper
    • zookeeper3.4.10集群方式安装
      • 安装
      • 上传并解压zookeeper-3.4.10包
      • 配置zookeeper
      • 在mini2和mini3上安装zookeeper
      • 启动zookeeper集群
      • 附录
        • 启动zookeeper集群脚本
  • BigData
  • Zookeeper
2018-07-15
目录

zookeeper3.4.10集群方式安装

# 安装

本次将zookeeper安装至/usr/local/hadoop/zookeeper-3.4.10/目录下

下载:

zookeeper3.4.10下载 (opens new window)

linux环境准备:

注意:准备服务器台数的时候要注意,一定要是奇数(1,3,5,7台机器)

序号 IP hostname
1 192.168.56.121 mini1
2 192.168.56.122 mini2
3 192.168.56.123 mini3

# 上传并解压zookeeper-3.4.10包

[root@mini1 soft]# tar -zxvf zookeeper-3.4.10.tar.gz
1

# 配置zookeeper

修改zoo.cfg文件

[root@mini1 soft]# cd /usr/local/hadoop/zookeeper-3.4.10/conf/
# 复制一份zoo.cfg配置文件
[root@mini1 conf]# cp zoo_sample.cfg zoo.cfg
# 配置zoo.cfg
[root@mini1 conf]# vi zoo.cfg
1
2
3
4
5

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 <span style='color:red;'>需要修改,自行创建zkdata目录</span>
dataDir=/usr/local/hadoop/zookeeper-3.4.10/zkdata
# 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
# <span style='color:red;'>这里的机器台数一定要是奇数</span>
server.1=mini1:2888:3888
server.2=mini2:2888:3888
server.3=mini3:2888:3888
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

创建节点myid文件

# 创建/usr/local/hadoop/zookeeper-3.4.10/zkdata目录
[root@mini1 conf]# mkdir /usr/local/hadoop/zookeeper-3.4.10/zkdata
[root@mini1 conf]# cd /usr/local/hadoop/zookeeper-3.4.10/zkdata
[root@mini1 zkdata]# echo 1 >myid
1
2
3
4

# 在mini2和mini3上安装zookeeper

使用scp命令将mini1上配置的zookeeper复制到mini2和mini3机器上

[root@mini1 conf]# scp -r /usr/local/hadoop/ mini2:/usr/local/
[root@mini1 conf]# scp -r /usr/local/hadoop/ mini3:/usr/local/
1
2

修改mini2上的myid文件内容为2

修改mini3上的myid文件内容为3

# 启动zookeeper集群

分别在三台机器上执行zkServer.sh start命令

[root@mini1 conf]# zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /usr/local/hadoop/zookeeper-3.4.10/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@mini1 conf]#
[root@mini1 conf]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/hadoop/zookeeper-3.4.10/bin/../conf/zoo.cfg
Mode: follower
[root@mini1 conf]#
1
2
3
4
5
6
7
8
9
10

# 附录

# 启动zookeeper集群脚本

start-zk.sh

#!/bin/sh
#启动zookeeper集群脚本
echo "start zookeeper..."
for i in 1 2 3
do
ssh mini$i "source /etc/profile;/usr/local/hadoop/zookeeper-3.4.10/bin/zkServer.sh start"
done
1
2
3
4
5
6
7
#zookeeper
最后更新时间: 2022/7/23 10:17:11
Zookeeper

← Zookeeper

最近更新
01
分区分桶
08-21
02
数据模型(重要)
08-21
03
安装和编译
08-21
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式