三台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. python中numpy.r_和numpy.c_

    例子 import numpy as np a = np.array([1, 2, 3]) b = np.array([4, 5, 6]) c = np.c_[a,b] print(np.r_[a,b ...

  2. CSS-网站导航栏标题之间的分隔符

    在一个网页上,尤其是导航栏文字与文字之间,大多数情况下都会有分隔符,也就是文字之间的一个小竖线,这个小小的分隔符,每个网站都有不同的样式,常用的写法就是用标签的边框,这个写法也比较简单,用起来也方便, ...

  3. 数据库查询字段为null 时,返回0

    oracle select nvl(字段名,0) from 表名; sqlserver select isnull(字段名,0) from 表名; mysql select ifnull(字段名,0) ...

  4. Component Interface相关面试题

    下面的列表中的问题很常见,Component Interface是很重要的.你知道基本知识比知道答案更重要. Q:以下陈述是错误的. A:一个Component Interface 可以map多个Pe ...

  5. MaxScript与外部程序通讯

    最近项目要求通过java给max发送任务指令,max接收指令执行任务,并且返回执行的结果.不管为什么会有这样的需求,有就要去实现. 1.OLE开启 Max本身提供了一个方式,它可以将自己注册成一个Ol ...

  6. 活字格Web应用平台学习笔记4 - 添加记录

    今天继续学习活字格基础教程,目标是创建一个页面,增加记录. 开始之前,系统会自动把上一次的工程文件加载进来. 这是做好后的样子. 我点添加员工的超链接: 先后加了2条员工的信息进来. 不错,设计界面是 ...

  7. VC中添加头文件以及库

    原文:http://blog.csdn.net/lwb102063/article/details/52068389   附加头文件包含 VC6.0中: VC6.0默认include包含路径:Tool ...

  8. .NET 获取类内成员的名称,以字符串形式显示

    需要做一个功能,显示类内的属性名和对应的值.比如有类 Public Class SupervisedParams     Public TestMode As string     Public Ti ...

  9. chrome浏览器使用chrome://inspect调试app 网页,打开空白的问题

    使用chrome浏览器,输入chrome://inspect可以调试android app里面的网页,如果inspect的时候,是空白, 问题截图: 那就在C:\Windows\System32\dr ...

  10. linux下搭建hexo环境

    最近对搭建个人博客比较感兴趣,但是刚搭建好next主题基本博客,电脑就坏了,借了一台电脑继续搞,不想在他电脑中弄太多环境,所以我准备在自己电脑的服务器上搭建hexo环境 服务器环境: (1)cento ...