三台CentOS:Host0,Host1,Host2

在三台中分别安装zookeeper-server

yum install zookeeper-server -y

修改zookeeper的配置文件(/etc/zookeeper/conf/zoo.cfg)

因为zookeeper集群共有3个节点,所以在配置文件中添加server.0,server.1,server.2

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. maxClientCnxns=
# 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.
dataDir=/var/lib/zookeeper
# the port at which the clients will connect
clientPort=
# the directory where the transaction logs are stored.
dataLogDir=/var/lib/zookeeper
#server
server. = Host0::
server. = Host1::
server. = Host2::

2888:3888是Zookeeper多节点之间的通信端口

2888接收端端口,3888发送端端口

在各个Host中添加myid文件,并修改文件所属用户。

echo "" > /var/lib/zookeeper/myid
chown zookeeper:zookeeper /var/lib/zookeeper/myid

注意,三个主机的/var/lib/zookeeper/myid文件内容不能相同,且与之间的server.0,server.1,server.2的0,1,2相对应。

初始化zookeeper,并启动zookeeper

service zookeeper-server init
service zookeeper-server start

查看zookeeper节点状态

[root@Host0 ~]# zookeeper-server status
JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: follower [root@Host1 ~]# zookeeper-server status
JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: leader [root@Host2 ~]# zookeeper-server status
JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: follower

可得Host1是leader,Host0和Host2是follower

CentOS中配置CDH版本的ZooKeeper的更多相关文章

  1. CentOS中配置Kafka集群

    环境:三台虚拟机Host0,Host1,Host2 Host0:192.168.10.2 Host1:  192.168.10.3 Host2:  192.168.10.4 在三台虚拟机上配置zook ...

  2. VS Code中配置python版本以及Python多版本

    VS Code中配置python版本VS Code十分方便配置python的版本:可以选在在本地setting.json或者全局setting.json文件中配置:python.pythonPath在 ...

  3. 【Hadoop离线基础总结】CDH版本的zookeeper环境搭建

    CDH版本的zookeeper环境搭建 下载 下载地址 http://archive.cloudera.com/cdh5/cdh/5/ 修改配置文件 创建ZooKeeper数据存放目录 mkdir - ...

  4. CentOS中配置LNMP环境打开提示File not found

    在centos系统中配置好php环境了,但是发现能运行html页面并不能运行php文件了,这样我就在gg的帮助下一步不解决了,下面来看问题的具体解决过程.     安装之后测试发现,怎么Html能运行 ...

  5. maven中配置jdk版本

    1 maven 中配置 <build> <plugins> <plugin> <groupId>org.apache.maven.plugins< ...

  6. cdh版本的zookeeper安装以及配置(伪分布式模式)

    需要的软件包:zookeeper-3.4.5-cdh5.3.6.tar.gz  1.将软件包上传到Linux系统指定目录下: /opt/softwares/cdh 2.解压到指定的目录:/opt/mo ...

  7. 2017-03-05 CentOS中配置守护服务(Supervisor)监听dotnet core web程序的运行

    我们继续解决上篇博客的问题,我这个人有个毛病,不喜欢遗留什么问题,也不喜欢问题说不明白,具体要怎么解决一定要详尽,因为经常自己遇到问题的时候,去翻别人的博客,就会遇到这样的问题,很苦恼,又说废话了. ...

  8. CentOS中配置NFS

    https://www.cnblogs.com/yeungchie/ NFS是Network File System的缩写,即网络文件系统. 它的主要功能是通过网络(一般是局域网)让不同的主机系统之间 ...

  9. CentOS中配置xrdp,通过微软远程桌面访问CentOS桌面

    环境:CentOS 6.4 1.安装相关软件 yum groupinstall "Desktop" (已安装桌面的就可以缺略这条命令) yum install xrdp yum i ...

随机推荐

  1. hadoop的namenode启动失败

    1.jps发现namenode启动失败 每次开机都要重新格式化一下namenode才可以 其实问题出现自tmp文件上,因为每次开机就会被清空,所以现在我们配置一个tmp文件目录. 如果之前没有配置过, ...

  2. js-ES6学习笔记-字符串的扩展

    1.codePointAt方法是测试一个字符由两个字节还是由四个字节组成的最简单方法.codePointAt方法会正确返回32位的UTF-16字符的码点. function is32Bit(c) { ...

  3. angularjs1.X获取前一天日期

    $scope.getDate = new Date(); //可以当前日期 $scope.nowDate = $filter("date")($scope.getDate, &qu ...

  4. react native进阶

    一.前沿||潜心修心,学无止尽.生活如此,coding亦然.本人鸟窝,一只正在求职的鸟.联系我可以直接微信:jkxx123321 二.项目总结 **||**文章参考资料:1.  http://blog ...

  5. Sqlserver数据库中的临时表详解

    临时表在Sqlserver数据库中,是非常重要的,下面就详细介绍SQL数据库中临时表的特点及其使用,仅供参考. 临时表与永久表相似,但临时表存储在tempdb中,当不再使用时会自动删除.临时表有两种类 ...

  6. winform中容器是如使用的

    1.容器 (1)FlowLayouPanel 普通容器[内部流式布局] (2)Groupbox 带有标题的普通容器[内部普通布局,超出范围隐藏] (3)Panel 普通容器[内部普通布局,超出范围隐藏 ...

  7. 转:前端js、jQuery实现日期格式化、字符串格式化

    1. js仿后台的字符串的StringFormat方法 在做前端页面时候,经常会对字符串进行拼接处理,但是直接使用字符串拼接,不但影响阅读,而且影响执行效率,且jQuery有没有定义字符串的Strin ...

  8. 记一次隐秘的XSS漏洞挖掘

    前言 在为某客户网站做渗透测试时发现一个有趣的事情.当我访问该网站的某条链接时服务器返回的是404页面.看到这里我当时就下意识的忽略它,但是后来又想了想这也不是完全没有价值,毕竟中间件及其版本都出来了 ...

  9. Mysql学习第二天

    Mysql语句执行 用户登录与管理 mysql -uroot -p -hlocalhost test # 指定登录test数据库 mysql -uroot -p -hlocalhost company ...

  10. IIS中添加MIME类型

    今天上传一个html5后台管理模版的时候,在服务器上预览发现网页加载的远程woff类型的字体不显示,如下图所示: 在本地预览的时候,正常加载字体文件应该是这样的: 利用url访问字体文件的时候提示:该 ...