Apache Zookeeper 使用-安装

官方网站

Zookeeper 是什么?

ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications. Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them, which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed.

总结:ZooKeeper 是一个分布式协调服务。

安装步骤

环境要求:JDK 1.8+
JDK 安装可参考:https://www.cnblogs.com/lihw-study/p/15201670.html

1、下载安装包

下载地址:https://downloads.apache.org/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz

这里使用 3.6.3 版本。

2、上传到服务器并解压压缩包

# 解压  tar 包
tar -xzvf apache-zookeeper-3.6.3-bin.tar.gz

3、重命名配置文件

如果 zoo.cfg 存在,那么跳过此步骤。

cd /opt/zookeeper/apache-zookeeper-3.6.3-bin/conf
cp zoo_sample.cfg zoo.cfg

查看 zoo.cfg 内容:

# 心跳间隔,单位:毫秒
tickTime=2000
# 初始化同步数据允许花费的时间,10 * tickTime = 20秒
initLimit=10
# 发送请求和获取ACK 确认的时间间隔 5 * tickTime = 10秒
syncLimit=5
# 快照保存的路径
dataDir=/tmp/zookeeper
# zookeeper 服务占用端口
clientPort=2181
# 客户端链接的最大数量
#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 ## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

4、修改 zoo.cfg 配置参数

4.1、单机部署

需要修改的参数有:

tickTime=2000  # 心跳时间间隔,单位:毫秒
dataDir=/var/lib/zookeeper # 数据文件存放路径
clientPort=2181 # 占用端口

修改后:

tickTime=2000  # 心跳时间间隔,单位:毫秒
dataDir=/opt/zookeeper/apache-zookeeper-3.6.3-bin/data # 数据文件存放路径
clientPort=2181 # 占用端口

4.2、集群部署

需要修改的参数有:

tickTime=2000
dataDir=/var/lib/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=zoo1:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888

5、单机启动 zookeeper

/opt/zookeeper/apache-zookeeper-3.6.3-bin/bin
./zkServer.sh start

校验:

/opt/zookeeper/apache-zookeeper-3.6.3-bin/bin
./zkCli.sh -server 127.0.0.1:2181

查看 /opt/zookeeper/apache-zookeeper-3.6.3-bin/data 下的数据文件:

至此,zookeeper 安装完成。

Apache Zookeeper 使用-安装的更多相关文章

  1. apache zookeeper的安装

    original article:http://zookeeper.praveendeshmane.co.in/zookeeper/zookeeper-3-4-6-single-server-setu ...

  2. 决战大数据之三-Apache ZooKeeper Standalone及复制模式安装及测试

    决战大数据之三-Apache ZooKeeper Standalone及复制模式安装及测试 [TOC] Apache ZooKeeper 单机模式安装 创建hadoop用户&赋予sudo权限, ...

  3. windows下安装apache zookeeper

    ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件.它是一个为分布式应用提供一致性服务的软件,提供的功 ...

  4. 在 Linux 多节点安装配置 Apache Zookeeper 分布式集群

    规划: 三台物理服务器就形成了(法定人数).对于高可用性集群,您可以使用高于3的任何奇数.例如,如果设置5台服务器,则集群可以处理两个故障节点等. 物理服务器需要开启的端口 2888 , 3888 和 ...

  5. zookeeper-3.5.5安装报错:找不到或无法加载主类 org.apache.zookeeper.server.quorum.QuorumPeerMain

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/jiangxiulilinux/artic ...

  6. (原) 1.1 Zookeeper单机安装

    本文为原创文章,转载请注明出处,谢谢 zookeeper 单机安装配置 1.安装前准备 linux系统(此文环境为Centos6.5) Zookeeper安装包,官网https://zookeeper ...

  7. 初识zookeeper(一)之zookeeper的安装及配置

    1.简要介绍 zookeeper是一个分布式的应用程序协调服务,是Hadoop和Hbase的重要组件,是一个树型的目录服务,支持变更推送.除此还可以用作dubbo服务的注册中心. 2.安装 2.1 下 ...

  8. zookeeper[4] 安装windows zookeeper,及问题处理

    安装步骤: 1.在如下路径下载zookeeper-3.4.7.tar.gz http://mirrors.cnnic.cn/apache/zookeeper/stable/ 2.解压zookeeper ...

  9. ZooKeeper的安装、配置、启动和使用(一)——单机模式

    ZooKeeper的安装.配置.启动和使用(一)——单机模式 ZooKeeper的安装非常简单,它的工作模式分为单机模式.集群模式和伪集群模式,本博客旨在总结ZooKeeper单机模式下如何安装.配置 ...

随机推荐

  1. C#中值类型与引用类型

    值类型 A,像int, float, char , double,bool等都是值类型 B,string, 自定义类等都是引用类型 它们的区别:源于复制策略的不同, 值类型直接包含值,换言之,变量引用 ...

  2. python3输出“水仙花数”

    for num in range(100,1000): #如果num在[100,1000)范围,就依次循环取出num的值,第一次取100,下一次取101....最后一次取999 bai = num / ...

  3. 爬虫简介与requests模块

    爬虫简介与requests模块 一 爬虫简介 概述 网络爬虫是一种按照一定规则,通过网页的链接地址来寻找网页的,从网站某一个页面(通常是首页)开始,读取网页的内容,找到网页中的其他链接地址,然后通过这 ...

  4. C#XmlHelper帮助类操作Xml文档的通用方法汇总

    前言 该篇文章主要总结的是自己平时工作中使用频率比较高的Xml文档操作的一些常用方法和收集网上写的比较好的一些通用Xml文档操作的方法(主要包括Xml序列化和反序列化,Xml文件读取,Xml文档节点内 ...

  5. k8s集群搭建过程详解

    准备工作 安装CentOS7虚拟机 略 安装Docker 略 关闭CentOS7自带的防火墙服务 systemctl disable firewalld systemctl stop firewall ...

  6. 数据结构-二叉树、B树、B+树、B*树(整理版)

    1. 二叉树 二叉树的特点: ① 所有非叶子节点至多拥有两个儿子(Left和Right): ② 所有节点存储一个关键字: ③ 非叶子节点的左指针指向小于其关键字的子树,右指针指向大于其关键字的子树: ...

  7. Mybatis 的一级、二级缓存?

    1)一级缓存: 基于 PerpetualCache 的 HashMap 本地缓存,其存储作用域为 Session,当 Session flush 或 close 之后,该 Session 中的所有 C ...

  8. JVM的小总结(转)

    ref:http://www.cnblogs.com/ityouknow/p/6482464.html 注1:看了大神:纯洁的微笑的JVM系列篇,发现好多地方还是似懂非懂,理解的并不透彻,jvm的调优 ...

  9. Spring框架中有哪些不同类型的事件?

      Spring 提供了以下5种标准的事件: (1)上下文更新事件(ContextRefreshedEvent):在调用ConfigurableApplicationContext 接口中的refre ...

  10. jQuery--事件案例(鼠标提示)

    1.文字提示 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww ...