zookeeper-02 部署
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 部署的更多相关文章
- ZooKeeper 安装部署及hello world(转)
ZooKeeper 安装部署及hello world 先给一堆学习文档,方便以后查看官网文档地址大全:OverView(概述)http://zookeeper.apache.org/doc/r3.4 ...
- ZooKeeper 安装部署及hello world
ZooKeeper 安装部署及hello world 先给一堆学习文档,方便以后查看官网文档地址大全: OverView(概述)http://zookeeper.apache.org/doc/r3. ...
- ZooKeeper的部署和测试
一背景 zookeeper是一个开源的分布式应用程序协调服务,是Apache Hadoop 的一个子项目.它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护.名字服务.分布式同步.组服 ...
- spark standalone zookeeper HA部署方式
虽然spark master挂掉的几率很低,不过还是被我遇到了一次.以前在spark standalone的文章中也介绍过standalone的ha,现在详细说下部署流程,其实也比较简单. 一.机器 ...
- Zookeeper安装部署
Zookeeper安装 1. 安装 wget http://www.apache.org/dist//zookeeper/zookeeper-3.3.6/zookeeper-3.3.6.tar.gz ...
- zookeeper分布式部署方案
版本:http://apache.fayea.com/zookeeper/zookeeper-3.4.8/环境:debian 7/8说明:最低配置3台步骤:1.下载zookeeper-3.4.8并解压 ...
- ZooKeeper 02 - ZooKeeper集群的节点为什么是奇数个
目录 1 关于节点个数的说明 2 ZooKeeper集群的容错数 3 ZooKeeper集群可用的标准 4 为什么不能是偶数个节点 4.1 防止由脑裂造成的集群不可用 4.2 奇数个节点更省资源 4. ...
- ES 02 - 部署Elasticsearch单机服务 + 部署中的常见问题
目录 1 准备工作 1.1 安装JDK 1.2 下载安装包 1.3 创建elastic用户 2 启动ES服务 2.1 修改配置文件 2.2 启动服务 3 验证ES服务是否可用 4 关闭与重启服务 4. ...
- zookeeper 学习 zookeeper下载部署
下载 http://mirror.bit.edu.cn/apache/zookeeper/ 校验 解压后得到zookeeper-3.4.10.jar,使用md5sum zookeeper-3.4.10 ...
- zookeeper分布式部署-mac先测试
由于平台马上要引入zookeeper+dubbo,为了解决zookeeper单个实例运行的风险,需要做个集群. 1,先说配置:zoo.cfg十分简单,分两种情况: 一种是在一台机器采用不同的端口配置多 ...
随机推荐
- Python 通过 SMTP 发送邮件
Python版本:Python3.5.2 简介 SMTP是发送邮件的协议,Python 内置对 SMTP 的支持,可以发送纯文本邮件.HTML 邮件以及带附件的邮件. Python 对 SMTP 支持 ...
- Avos Cloud 的 ParseObject的创建与数据存储检索
创建/存储数据: ParseObject gameScore = new ParseObject("GameScore"); gameScore.put("score&q ...
- T-SQL:qualify和window 使用(十七)
1.qualify 是一个潜在的额外筛选器 主要用于对开窗函数的数据筛选 SELECT orderid, orderdate, val, RANK() OVER(ORDER BY val DESC) ...
- HbuilderX 常用快捷键
最新2019.3.30版本已经添加idea的快捷键,就不需要再额外记住HbuilderX的快捷键啦~ 链接 输入a,按下tab 加粗 ctrl+B 换行 需要换行的那一行后面加2个空格(或者按下tab ...
- Java学习笔记之——this关键字、非静态成员属性和静态成员属性的区别、类的加载顺序
一.this关键字 1.代表当前类的对象 2.通过” . ”调用成员属性和成员方法 3.通过this可以区分成员属性和参数 参数名和属性名相同的情况,默认是参数名 二.非静态成员属性和静态成员属性的区 ...
- Partition(hdu4651)2013 Multi-University Training Contest 5
Partition Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- Netty 系列四(ChannelHandler 和 ChannelPipeline).
一.概念 先来整体的介绍一下这篇博文要介绍的几个概念(Channel.ChannelHandler.ChannelPipeline.ChannelHandlerContext.ChannelPromi ...
- MongoDB 3.0 WT引擎参考配置文件
单实例: systemLog: destination: file ###日志存储位置 path: /data/mongodb/log/mongod.log logAppend: true stora ...
- 如何用ABP框架快速完成项目(7) - 用ABP一个人快速完成项目(3) - 通过微服务模式而不是盖楼式来避免难度升级和奥卡姆剃刀原理
这节文章十分重要!十分重要!十分重要! 很多同学在使用ABP的过程中遇到很多问题, 花费了很多时间和精力都还无法解决, 就是卡在这节文章这里. Talk is cheap, just show ...
- maven 继承
一个 maven 项目可以继承另一个 maven 的依赖, 称为子项目 父项目 使用场景: 多个子项目都需要某些依赖, 就可以把子项目共同的依赖抽取到父项目中, 子项目通过继承得到这些依赖, 这样也更 ...