三台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. Codeforces343D(SummerTrainingDay06-F dfs序+线段树)

    D. Water Tree time limit per test:4 seconds memory limit per test:256 megabytes input:standard input ...

  2. HDU4704(SummerTrainingDay04-A 欧拉降幂公式)

    Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submi ...

  3. 设计模式(23)--Visitor--访问者模式--行为型

    作者QQ:1095737364    QQ群:123300273     欢迎加入! 1.模式定义:    访问者模式是对象的行为模式.访问者模式的目的是封装一些施加于某种数据结构元素之上的操作.一旦 ...

  4. jq插件写法

    如今做web开发,jQuery 几乎是必不可少的,同时jquery插件也是不断的被大家所熟知,以及运用.最近在搞这个jquery插件,发现它的牛逼之处,所以讲一讲jQuery插件的写法以及使用  (f ...

  5. CentOS6.5搭建ldap及pdc的过程

    linux   centos6.5,,配置的是本地yum,采用光盘自带的rpm包进行安装 安装openldap server 以及client yum install openldap-server ...

  6. ebook

    libgen.io onlybooks.org www.ebook3000.com www.foxebook.net

  7. MonkeyRunner进坑——errors importing other modules

    后知后觉,刚知道Android提供了MonkeyRunner这么个东西,能用来干嘛呢,官方文档介绍得很清楚.简单说,可以用Python程序通过API, installs an Android appl ...

  8. Oracle 修改SYS、system用户密码

    Oracle 修改SYS.system用户密码 by:授客 QQ:1033553122 概念 SYS用户是Oracle中权限最高的用户,而SYSTEM是一个用于数据库管理的用户.在数据库安装完之后,应 ...

  9. qt调用js,js调用qt

    <html> <script language="JavaScript"> function qtcalljs() { alert("sdfsd& ...

  10. 回归JavaScript基础(十)

    主题:创建对象 原型模式 JavaScript中的每个对象都有一个prototype属性(原型属性),这个属性是一个指针,指向一个对象,而这个对象可以由一些属性和方法组成.被指向的对象,可以是多个对象 ...