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十分简单,分两种情况: 一种是在一台机器采用不同的端口配置多 ...
随机推荐
- shell中$后加引号有什么用($"string"和$'string')
bash&shell系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 有些时候在某些服务管理脚本中看到$"$string& ...
- nginx静态资源文件无法访问,403 forbidden错误
在安装 nginx 服务器后,我想把网站的根目录设置为 /root/www/ ,于是对 nginx 的 nginx.conf 文件进行配置 先打开 nginx.conf #user nobody; w ...
- 如何快速将一个list<a>集合中的部分字段值组合成新的的list<b>部分*
有的时候,我们只需要从老数据中拿一部分数据作为新的绑定数据,比如说绑定下拉框的时候需要构造我们需要的数据格式可以采用以下的方法 public class SelectDataViewModel { p ...
- C#.NET 中的 Timer 计时器及 3 种使用方法
定时器是系统常用的组件之一,程序员可以根据自己的需求定制一个定时器类型,也可以使用.net内建的定时器类型.在.net中一共为程序员提供了3种定时器: System.Windows.Forms.Tim ...
- java回调函数学习
前不久学习了代理模式,其中有一个核心之一是Proxy.newProxyInstance();这里有三个参数, loader:目标对象的类加载器 interfaces:目标对象实现的所有接口组成的数组 ...
- idea项目git版本回退
idea项目git版本回退 一.查询提交历史 项目上右键,点击Git,点击Show History 二.复制版本号 我这里有两个测试的版本,我的当前版本是[二],所以我选择[一],右键,选择Copy ...
- 消息队列redis
1.消息队列流程 2.接收用户请求 <?php header("Content-type:text/html;charset=utf-8"); //首先加载redis组键 $ ...
- Salesforce 数据备份和恢复小知识
数据备份的类型 在Salesforce中可以使用多种API进行数据备份,它们是: REST API SOAP API Buik API Metadata API 数据备份有三种选择: 完全备份(Ful ...
- odoo:开源 ERP/CRM 入门与实践
看了这张图,或许你对odoo有了一些兴趣. 这次就是和大家一起交流开源ERP/CRM系统:odoo 对以下读者有帮助:研发.产品.项目.市场.服务.运营.管理等. 一.背景趋势 社交网络.电商O2O: ...
- 简单 PHP + MySQL 数据库动态网站制作 -- 摘抄
在这篇文章中,我尽量用最浅显易懂的语言来说明使用 PHP, MySQL 制作一个动态网站的基本技术.阅读本文需要简单的 HTML 基础知识和(任一编程语言的)编程基础知识(例如变量.值.循环.语句块的 ...