参考:https://www.linuxidc.com/Linux/2016-09/135052.htm

1.zookeeper运行需要jdk环境,先确保有配置jdk,可以参考此处

2.下载解压zookeeper

  先创建下载目录

 mkdir -p /usr/local/services/zookeeper

  进入zookeeper目录

cd /usr/local/services/zookeeper

  下载稳定的zookeeper版本,可参考zookeeper官方下载地址,选择稳定版本,此处下载的是3.4.10版本

 wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.10/zookeeper-3.4.10.tar.gz

  解压文件

 tar -zxvf zookeeper-3.4.10.tar.gz

3.修改zookeeper配置文件

  进入到 /usr/local/services/zookeeper/zookeeper-3.4.10/conf 目录中,复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg:

 cp zoo_sample.cfg zoo.cfg

  用 vim 打开 zoo.cfg 文件并修改其内容为如下:

# The number of milliseconds of each tick

    # zookeeper 定义的基准时间间隔,单位:毫秒
tickTime=2000 # The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
# dataDir=/tmp/zookeeper # 数据文件夹
dataDir=/usr/local/services/zookeeper/zookeeper-3.4.10/data # 日志文件夹
dataLogDir=/usr/local/services/zookeeper/zookeeper-3.4.10/logs # the port at which the clients will connect
# 客户端访问 zookeeper 的端口号
clientPort=2181 # the maximum number of client connections.
# increase this if you need to handle more clients
#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

4.配置zookeeper环境变量

  用 vim 打开 /etc/ 目录下的配置文件 profile:

vim /etc/profile

  在其底部空白处追加如下内容

    #--- update for zookeeper---start
export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.10/
export PATH=$ZOOKEEPER_HOME/bin:$PATH
export PATH
#---update for zookeeper---end

  使修改文件生效

source /etc/profile

5.操作zookeeper

  启动

zkServer.sh start

  查看运行状态

zkServer.sh status

  停止

 zkServer.sh stop

  重启

 zkServer.sh restart

在CentOS7中安装zookeeper的更多相关文章

  1. centos7上安装zookeeper

    centos7上安装zookeeper 1 准备工作 1.准备服务器,本次安装采用 centos7系统.内存2G.存储60G的虚拟机服务器一台: 2.服务器安装java环境: 参考文章<cent ...

  2. centos7下安装zookeeper&zookeeper集群的搭建

    一.centos7下安装zookeeper 1.zookeeper 下载地址 https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/ 2.安装步骤 ...

  3. 在centos7中安装Robot Framework

    安装前景介绍: 最初,我们是在Windows环境下搭建Robot Framework来对我们的服务进行接口测试的(想知道如何在Windows下安装Robot Framework,可以参考我同事的博客h ...

  4. centos7中安装、配置、验证、卸载redis

    本文介绍在centos7中安装.配置.验证.卸载redis等操作,以及在使用redis中的一些注意事项. 一 安装redis 1 创建redis的安装目录 利用以下命令,切换到/usr/local路径 ...

  5. centos7中安装mongodb3.6

    centos7中安装mongodb3.6 首先更新系统 yum -y update 1.安装Mongodb 编辑Mongodb安装源 vim /etc/yum.repos.d/mongodb-org- ...

  6. 如何在Centos7上安装zookeeper 多实例

    一.如何在Centos7上安装zookeeper 多实例 cd /usr/local/src/ wget https://mirrors.tuna.tsinghua.edu.cn/apache/zoo ...

  7. 在Centos7中安装elasticsearch5.5

    在Centos7中安装elasticsearch5.5 第一步:必须要有jre支持 elasticsearch是用Java实现的,跑elasticsearch必须要有jre支持,所以必须先安装jre ...

  8. centos7中安装mysql

    centos7中安装mysql网上已经很多资源了,我就不在赘述了.我这里只是记录下我安装的时候出现的一些问题. 原文:https://www.cnblogs.com/bigbrotherer/p/72 ...

  9. CentOS7中安装MySQL(简便)及 网站的搭建

    一.首先,我们需要配置CentOS7中网络环境的搭建,物理机IP为192.168.100.39,虚拟机IP为192.168.100.139,网络模式设置为桥接模式 ,再进入系统挂载光盘.输入命令   ...

随机推荐

  1. 剑指offer-链表相关

    剑指offer面试常考手撸算法题-链表篇 1. 从头到尾打印链表 class Solution { public: // 可以先压栈,再出栈到vector // 时间/空间:O(n) vector&l ...

  2. java 原子操作(1) CAS

    在 java 多线程编程中经常说的就是:“原子操作(atomic operation) 不需要 synchronized”. 原子操作指的是不会被线程调度机制打断的操作:这种操作一旦开始,就一直运行到 ...

  3. ResourceManager学习之ApplicationMaster,NodeManager管理

    ApplicationMaster管理部分主要由三个服务构成,分别是ApplicationMasterLauncher.AMLivelinessMonitor和ApplicationMasterSer ...

  4. await在forEach不起作用解决【await is a reserved word】

    原文链接:https://blog.csdn.net/ssbb1995/article/details/82084800 1.await 只能在 async中使用,如: async function ...

  5. JAVA笔记整理(九),JAVA中的集合

    在工作中,我们经常需要将多个对象集中存放,可以使用数组,但是数组的长度一旦固定之后是不可变的,为了保存数量确定的数据,我们可以使用JAVA中的集合. 在我看来,JAVA中的集合可以看作是一个特殊的数据 ...

  6. Spark foreachpartiton和mappartition的异同

    相同 都是对分区进行操作 不同 1.foreachpartition是Action操作,mappartition是Transformation操作 2.foreachpartition无返回值,map ...

  7. Linux命令——pgrep

    参考:Linux pgrep Command Tutorial for Beginners (10 Examples) Linux命令——ps.pstree bash基础——grep.基本正则表达式. ...

  8. 【转】通过BeanNameAutoProxyCreator改变臃肿代码

    https://www.cnblogs.com/zdd-java/p/7861824.html 前言: 最近接手了一个项目,大概过了下需求,然后打开项目准备开搞的时候发现一个问题,这个项目是提供res ...

  9. NLP学习(4)----word2vec模型

    一. 原理 哈弗曼树推导: https://www.cnblogs.com/peghoty/p/3857839.html 负采样推导: http://www.hankcs.com/nlp/word2v ...

  10. node中的npm的使用

    1.node中npm的使用 nodejs软件 1.安装nodejs 自带了npm  npm install Bootstrap 好比python自带pip  pip3 install requests ...