三台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. linux系统编程:进程控制(fork)

    在linux中,用fork来创建一个子进程,该函数有如下特点: 1)执行一次,返回2次,它在父进程中的返回值是子进程的 PID,在子进程中的返回值是 0.子进程想要获得父进程的 PID 需要调用 ge ...

  2. org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException Line 47 in

    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 47 in XML document from ...

  3. vue中prop传值时加不加v-bind(冒号:)

    前言:有关Vue中父组件通过prop传值给子组件时,是否加v-bind的问题,没弄清楚时感觉很乱,弄清楚之后很简单. 由于结果记起来很容易,所以先给出结果: 只有传递字符串常量时,不采用v-bind形 ...

  4. 【代码笔记】iOS-UITableView上的button点击事件

    代码. ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController < ...

  5. jquery判断浏览器的内核

    <script type='text/javascript'> $(function(){ if($.browser.msie) { alert("IE浏览器"); } ...

  6. flutter 防止键盘弹出 导致超出屏幕

    return Scaffold( appBar: AppBar( elevation: 0.0, title: new Text("登陆"), ), resizeToAvoidBo ...

  7. Mac配置SDK+JDK环境

    1.打开默认终端设备,编辑.bash_profile文件,命令:vi .bash_profile 2.执行,打开文件,编辑,配置环境命令如下: ①JDK环境:export JAVA_HOME=/lib ...

  8. 分享一个android debug模式,出现 waiting for debugger把界面卡住,取巧的解决办法

    使用android studio开发程序时,有时会出现 waiting for debugger 卡住界面,软件无法正常debug运行的情况,很多网友分享了一些解决办法,比如: 1 打开cmd进入命令 ...

  9. Oracle EBS AR 其他API

    DECLARE L_CR_ID NUMBER; L_ATTRIBUTE_REC AR_RECEIPT_API_PUB.ATTRIBUTE_REC_TYPE; L_GLOBAL_ATT_REC AR_R ...

  10. No module named 'MySQLdb' Python3 + Django 2.0.3 + mysql 无法连接

    问题概览: 学习Django连接mysql数据库的时候遇到了问题 首先安装mysql(Python 3不支持MySQL-python): pip install pymysql 进入编辑 settin ...