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. JavaScript 系列博客(六)

    JavaScript 系列博客(六) 前言 本篇博客介绍 js 操作高级,通过 js 获取标签的全局属性.设置标签的全局属性,以及事件的绑定与取消.js 盒模型与 js 动画. 对象使用的高级 对象的 ...

  2. SQL语句NOT IN优化之换用NOT EXISTS

    NOT IN查询示例(示例背景描述:根据条件查询Questions表得到的数据基本在PostedData表中不存在,为完全保证查询结果在PostedData表中不存在,使用NOT IN): SET S ...

  3. 26.C++- 泛型编程之类模板(详解)

    在上章25.C++- 泛型编程之函数模板(详解) 学习了后,本章继续来学习类模板   类模板介绍 和函数模板一样,将泛型思想应用于类. 编译器对类模板处理方式和函数模板相同,都是进行2次编译 类模板通 ...

  4. Hibernate(十三)迫切内连接fetch

    迫切内连接fetch 内连接和迫切内连接的区别: 其主要区别就在于封装数据,因为他们查询的结果集都是一样的,生成底层的SQL语句也是一样的. 1.内连接:发送就是内连接的语句,封装的时候将属于各自对象 ...

  5. Spring Data REST API集成Springfox、Swagger

    原文: Documenting a Spring Data REST API with Springfox and Swagger 使用Spring Date REST,你可以迅速为Spring Da ...

  6. crontab工具安装和检查

    什么是crontab?crontab 是一个用于设置周期性执行任务的工具 重启crond守护进程 systemctl restart crond 查看当前crond状态 systemctl statu ...

  7. 微信分享链接出现config:invalid signature错误的解决方法

    首先贡献jssdk下载地址:http://demo.open.weixin.qq.com/jssdk/sample.zip  不建议大家在*SDN上花钱买积分下载 当开发微信时需要做特定的页面做分享时 ...

  8. mongodb数据分组按字符串split

    db.getCollection('users').aggregate([ {$match:{ZWBH:11}}, {$unwind:'$UUID'}, {$project : { PM : { $s ...

  9. Testlink1.9.17使用方法(第九章 测试结果分析)

    第九章 测试结果分析 QQ交流群:585499566 TestLink根据测试过程中记录的数据,提供了较为丰富的度量统计功能,可以直观的得到测试管理过程中需要进行分析和总结的数据.点击首页横向导航栏中 ...

  10. 使用Visual Studio Team Services持续集成(一)——构建ASP.NET Core

    使用Visual Studio Team Services持续集成(一)--构建ASP.NET Core 概述 持续集成(CI)是将代码尽可能频繁地集成到共享仓库中的过程.在代码集成期间,构建中断或测 ...