1. 主机规划

主机名称

外网IP【外部访问】

内网IP

操作系统

备注

安装软件

docker01

10.0.0.11

172.16.1.11

CentOS 7.2

zookeeper-3.4.5【集群】

docker02

10.0.0.12

172.16.1.12

CentOS 7.2

zookeeper-3.4.5【集群】

docker03

10.0.0.13

172.16.1.13

CentOS 7.2

zookeeper-3.4.5【集群】

docker04

10.0.0.14

172.16.1.14

CentOS 7.2

zookeeper-3.4.5【单独/伪集群】

其中zoo.cfg 的连接数如下:
maxClientCnxns=1000 具体就不在每个配置文件中写了
如果使用,请加上这个配置

  

2. Jdk【java8】

2.1.  软件安装

 [root@zhang tools]# pwd
/root/tools
[root@zhang tools]# tar xf jdk-8u162-linux-x64.tar.gz
[root@zhang tools]# ll
total
drwxr-xr-x Dec : jdk1..0_162
-rw-r--r-- root root Mar : jdk-8u162-linux-x64.tar.gz
-rw-r--r-- root root May : zookeeper-3.4..tar.gz
[root@zhang tools]# mv jdk1..0_162/ /app/
[root@zhang tools]# cd /app/
[root@zhang app]# ll
total
drwxr-xr-x Dec : jdk1..0_162
[root@zhang app]# ln -s jdk1..0_162/ jdk
[root@zhang app]# ll
total
lrwxrwxrwx root root May : jdk -> jdk1..0_162/
drwxr-xr-x Dec : jdk1..0_162

2.2.  环境变量

 [yun@iZ2zefjy4361ppunik5222Z ~]$ pwd
/app
[yun@iZ2zefjy4361ppunik5222Z ~]$ ll -d jdk* # 可以根据实际情况选择jdk版本,其中jdk1. 可以兼容 jdk1.
lrwxrwxrwx yun yun Mar : jdk -> jdk1..0_71
drwxr-xr-x yun yun Sep jdk1..0_71
drwxr-xr-x yun yun Dec : jdk1..0_162
[yun@iZ2zefjy4361ppunik5222Z profile.d]$ pwd
/etc/profile.d
[yun@iZ2zefjy4361ppunik5222Z profile.d]$ cat jdk.sh # java环境变量
export JAVA_HOME=/app/jdk
export JRE_HOME=/app/jdk/jre
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH

3. zookeeper【单机部署】

3.1.  配置信息

 # 路径
[root@zhang app]# pwd
/app
[root@zhang app]# ll
total
lrwxrwxrwx root root May : jdk -> jdk1..0_112/
drwxr-xr-x Sep jdk1..0_112
drwxr-xr-x games Nov zookeeper-3.4. # 配置文件
[root@zhang conf]# pwd
/app/zookeeper-3.4./conf
[root@zhang conf]# cp -a zoo_sample.cfg zoo.cfg
[root@zhang conf]# vim zoo.cfg
# The number of milliseconds of each tick #心跳间隔时间,zookeeper中使用的基本时间单位,毫秒值。每隔2秒发送一个心跳
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes. 数据目录 单独目录存放
dataDir=/app/bigdata/zookeeper/data
# the port at which the clients will connect
clientPort=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval=

3.2.  服务启动与停止

 # 启动服务
[root@zhang bin]# pwd
/app/zookeeper-3.4./bin
[root@zhang bin]# ./zkServer.sh start
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@zhang bin]#
[root@zhang bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: standalone # 停止服务
[root@zhang bin]# ./zkServer.sh stop
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED
[root@zhang bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Error contacting service. It is probably not running.

4. zookeeper【单机伪集群】

一台机器,在该台机器上运行多个ZooKeeper Server进程。

4.1.  软件基本信息

 [root@zhang app]# pwd
/app
[root@zhang app]# ll
total
drwxr-xr-x root root May : bigdata
lrwxrwxrwx root root May : jdk -> jdk1..0_112/
drwxr-xr-x Sep jdk1..0_112
drwxr-xr-x games May : zookeeper-3.4.5_01
drwxr-xr-x games May : zookeeper-3.4.5_02
drwxr-xr-x games May : zookeeper-3.4.5_03

4.2.  配置文件

4.2.1.   zookeeper-3.4.5_01 配置信息

 [root@zhang conf]# pwd
/app/zookeeper-3.4.5_01/conf
[root@zhang conf]# ll
total
-rw-r--r-- games Oct configuration.xsl
-rw-r--r-- games Oct log4j.properties
-rw-r--r-- games May : zoo.cfg
-rw-r--r-- games Oct zoo_sample.cfg
[root@zhang conf]# vim zoo.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes. 数据目录 单独目录存放 确保该目录存在
dataDir=/app/bigdata/zookeeper1/data
# the port at which the clients will connect
# 客户端端口 多个实例的端口配置不可重复
clientPort=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= #server.NUM=IP:port1:port2 NUM表示本机为第几号服务器;IP为本机ip地址;
#port1为leader与follower通信端口;port2为参与竞选leader的通信端口
#多个实例的端口配置不能重复,如下:
server.=172.16.1.14::
server.=172.16.1.14::
server.=172.16.1.14::

4.2.2.   zookeeper-3.4.5_02 配置信息

 [root@zhang conf]# pwd
/app/zookeeper-3.4.5_02/conf
[root@zhang conf]# ll
total
-rw-r--r-- games Oct configuration.xsl
-rw-r--r-- games Oct log4j.properties
-rw-r--r-- games May : zoo.cfg
-rw-r--r-- games Oct zoo_sample.cfg
[root@zhang conf]# vim zoo.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes. 数据目录 单独目录存放 确保该目录存在
dataDir=/app/bigdata/zookeeper2/data
# the port at which the clients will connect
# 客户端端口 多个实例的端口配置不可重复
clientPort=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= #server.NUM=IP:port1:port2 NUM表示本机为第几号服务器;IP为本机ip地址;
#port1为leader与follower通信端口;port2为参与竞选leader的通信端口
#多个实例的端口配置不能重复,如下:
server.=172.16.1.14::
server.=172.16.1.14::
server.=172.16.1.14::

4.2.3.   zookeeper-3.4.5_03 配置信息

 [root@zhang conf]# pwd
/app/zookeeper-3.4.5_03/conf
[root@zhang conf]# ll
total
-rw-r--r-- games Oct configuration.xsl
-rw-r--r-- games Oct log4j.properties
-rw-r--r-- games May : zoo.cfg
-rw-r--r-- games Oct zoo_sample.cfg
[root@zhang conf]# vim zoo.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes. 数据目录 单独目录存放
dataDir=/app/bigdata/zookeeper3/data
# the port at which the clients will connect
# 客户端端口 多个实例的端口配置不可重复
clientPort=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= #server.NUM=IP:port1:port2 NUM表示本机为第几号服务器;IP为本机ip地址;
#port1为leader与follower通信端口;port2为参与竞选leader的通信端口
#多个实例的端口配置不能重复,如下:
server.=172.16.1.14::
server.=172.16.1.14::
server.=172.16.1.14::

4.3.  添加myid文件

 [root@zhang bigdata]# cat /app/bigdata/zookeeper1/data/myid 

 [root@zhang bigdata]# cat /app/bigdata/zookeeper2/data/myid 

 [root@zhang bigdata]# cat /app/bigdata/zookeeper3/data/myid
 

4.4.  启动与查看状态

4.4.1.   依次启动

 # 第一台
[root@zhang bin]# pwd
/app/zookeeper-3.4.5_01/bin
[root@zhang bin]# ./zkServer.sh start
JMX enabled by default
Using config: /app/zookeeper-3.4.5_01/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED # 第二台
[root@zhang bin]# pwd
/app/zookeeper-3.4.5_02/bin
[root@zhang bin]# ./zkServer.sh start
JMX enabled by default
Using config: /app/zookeeper-3.4.5_02/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED # 第三台
[root@zhang bin]# pwd
/app/zookeeper-3.4.5_03/bin
[root@zhang bin]# ./zkServer.sh start
JMX enabled by default
Using config: /app/zookeeper-3.4.5_03/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

4.4.2.   查看状态

 # 第一台
[root@zhang bin]# pwd
/app/zookeeper-3.4.5_01/bin
[root@zhang bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4.5_01/bin/../conf/zoo.cfg
Mode: follower # 第二台
[root@zhang bin]# pwd
/app/zookeeper-3.4.5_02/bin
[root@zhang bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4.5_02/bin/../conf/zoo.cfg
Mode: leader # 第三台
[root@zhang bin]# pwd
/app/zookeeper-3.4.5_03/bin
[root@zhang bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4.5_03/bin/../conf/zoo.cfg
Mode: follower

5. zookeeper【集群】

5.1.   配置信息

 [root@docker01 conf]# pwd
/app/zookeeper-3.4./conf
[root@docker01 conf]# vim zoo.cfg
# The number of milliseconds of each tick
tickTime=
# The number of ticks that the initial
# synchronization phase can take
initLimit=
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/app/bigdata/zookeeper/data
# the port at which the clients will connect
clientPort=
#
# 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=
# Purge task interval in hours
# Set to "" to disable auto purge feature
#autopurge.purgeInterval= # leader和follow通信端口和投票选举端口
server.=172.16.1.11::
server.=172.16.1.12::
server.=172.16.1.13::

5.2.  添加myid文件

 [root@docker01 conf]# cd /app/bigdata/zookeeper/data   #
[root@docker01 data]# vim myid # 3台机器的myid分别为 、、 # 见开头的主机规划

5.3.  启动zk服务

 ##### 第1台、2台、3台 依次启动
[root@docker01 bin]# pwd
/app/zookeeper-3.4./bin
[root@docker01 bin]# ll
total
-rwxr-xr-x games Oct README.txt
-rwxr-xr-x games Oct zkCleanup.sh
-rwxr-xr-x games Oct zkCli.cmd
-rwxr-xr-x games Oct zkCli.sh
-rwxr-xr-x games Oct zkEnv.cmd
-rwxr-xr-x games Oct zkEnv.sh
-rwxr-xr-x games Oct zkServer.cmd
-rwxr-xr-x games Oct zkServer.sh
[root@docker01 bin]# ./zkServer.sh start
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

5.4.  查询运行状态

 # 第一台
[root@docker01 bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: follower # 第二台
[root@docker02 bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: leader # 第三台
[root@docker03 bin]# ./zkServer.sh status
JMX enabled by default
Using config: /app/zookeeper-3.4./bin/../conf/zoo.cfg
Mode: follower

zookeeper-02 部署的更多相关文章

  1. ZooKeeper 安装部署及hello world(转)

    ZooKeeper  安装部署及hello world 先给一堆学习文档,方便以后查看官网文档地址大全:OverView(概述)http://zookeeper.apache.org/doc/r3.4 ...

  2. ZooKeeper 安装部署及hello world

    ZooKeeper  安装部署及hello world 先给一堆学习文档,方便以后查看官网文档地址大全: OverView(概述)http://zookeeper.apache.org/doc/r3. ...

  3. ZooKeeper的部署和测试

    一背景 zookeeper是一个开源的分布式应用程序协调服务,是Apache Hadoop 的一个子项目.它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护.名字服务.分布式同步.组服 ...

  4. spark standalone zookeeper HA部署方式

    虽然spark master挂掉的几率很低,不过还是被我遇到了一次.以前在spark standalone的文章中也介绍过standalone的ha,现在详细说下部署流程,其实也比较简单. 一.机器 ...

  5. Zookeeper安装部署

    Zookeeper安装 1. 安装 wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz ...

  6. zookeeper分布式部署方案

    版本:http://apache.fayea.com/zookeeper/zookeeper-3.4.8/环境:debian 7/8说明:最低配置3台步骤:1.下载zookeeper-3.4.8并解压 ...

  7. ZooKeeper 02 - ZooKeeper集群的节点为什么是奇数个

    目录 1 关于节点个数的说明 2 ZooKeeper集群的容错数 3 ZooKeeper集群可用的标准 4 为什么不能是偶数个节点 4.1 防止由脑裂造成的集群不可用 4.2 奇数个节点更省资源 4. ...

  8. ES 02 - 部署Elasticsearch单机服务 + 部署中的常见问题

    目录 1 准备工作 1.1 安装JDK 1.2 下载安装包 1.3 创建elastic用户 2 启动ES服务 2.1 修改配置文件 2.2 启动服务 3 验证ES服务是否可用 4 关闭与重启服务 4. ...

  9. zookeeper 学习 zookeeper下载部署

    下载 http://mirror.bit.edu.cn/apache/zookeeper/ 校验 解压后得到zookeeper-3.4.10.jar,使用md5sum zookeeper-3.4.10 ...

  10. zookeeper分布式部署-mac先测试

    由于平台马上要引入zookeeper+dubbo,为了解决zookeeper单个实例运行的风险,需要做个集群. 1,先说配置:zoo.cfg十分简单,分两种情况: 一种是在一台机器采用不同的端口配置多 ...

随机推荐

  1. Go基础系列:为select设置超时时间

    Go channel系列: channel入门 为select设置超时时间 nil channel用法示例 双层channel用法示例 指定goroutine的执行顺序 After() 谁也无法保证某 ...

  2. [转]VirtualBox centos7扩容

    本文转自:https://www.cnblogs.com/xd502djj/p/7367704.html 有时候扩容还真不如重新建立一个大硬盘的系统,但是如果你安装了好多东西的话,那还是来扩容一下吧. ...

  3. 第一册:lesson sixty five.

    原文: Not a baby. A:What are you going to do this evening Jill? B:I'm going to meet some friends, dad. ...

  4. c# 用户自定义转换

    class Program { public string Name; public int Age; public Program(string name ,int age) { Name = na ...

  5. Message": "请求的资源不支持 http 方法“GET”

    今天用postman测试后端api,总是报错,下面是问题解决方案. 一.测试方法 public ApiResult Get(int id){ApiResult result = new ApiResu ...

  6. Java 原生网络编程.

    一.概念 Java 语言从其诞生开始,就和网络紧密联系在一起.在 1995 年的 Sun World 大会上,当时占浏览器市场份额绝对领先的网景公司宣布在浏览器中支持Java,从而引起一系列的公司产品 ...

  7. Go实现基于WebSocket的弹幕服务

    拉模式和推模式 拉模式 1.数据更新频率低,则大多数请求是无效的 2.在线用户量多,则服务端的查询负载高 3.定时轮询拉取,实时性低 推模式 1.仅在数据更新时才需要推送 2.需要维护大量的在线长连接 ...

  8. POJ1201 Intervals(差分约束)

    Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 28416   Accepted: 10966 Description You ...

  9. 洛谷P4589 [TJOI2018]智力竞赛(二分答案 二分图匹配)

    题意 题目链接 给出一个带权有向图,选出n + 1n+1条链,问能否全部点覆盖,如果不能,问不能覆盖的点权最小值最大是多少 Sol TJOI怎么净出板子题 二分答案之后直接二分图匹配check一下. ...

  10. js中判断空及获取当前服务的根路径

    function isValue(o) { return (this.isObject(o) || this.isString(o) || this.isNumber(o) || this.isBoo ...