下载zookeeper   Zookeeper下载

下载以后将文件迁移到/home/Hadoop/文件夹下面

hongdada@ubuntu:~/Downloads$ sudo mv zookeeper-3.4.9.tar.gz /home/Hadoop

tar -zxvf解压

hongdada@ubuntu:/home/Hadoop$ sudo tar -zxvf zookeeper-3.4.9.tar.gz

将文件夹zookeeper-3.4.9改成zookeeper

hongdada@ubuntu:/home/Hadoop$ sudo mv zookeeper-3.4.9 zookeeper

解压以后conf文件夹中创建zoo_sample.cfg的副本zoo.cfg

hongdada@ubuntu:/home/Hadoop$ cd zookeeper
hongdada@ubuntu:/home/Hadoop/zookeeper$ cd conf
hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ mp zoo_sample.cfg zoo_cfg
mp:未找到命令
hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ cp zoo_sample.cfg zoo.cfg
cp: 无法创建普通文件'zoo.cfg': 权限不够
hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ sudo cp zoo_sample.cfg zoo.cfg
hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ sudo gedit zoo.cfg

原始的zoo.cfg:

# The number of milliseconds of each tick
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
# the port at which the clients will connect
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

修改为:

# The number of milliseconds of each tick
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=/home/Hadoop/zookeeper/data # 数据持久化路径
dataLogDir=/home/Hadoop/zookeeper/log #日志保存路径
server.1=192.168.1.203:2888:3888 # the port at which the clients will connect
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

说明:

syncLimit=5 # Leader与Follower之间的最大响应时间单位,响应超过syncLimit*tickTime,Leader认为Follwer死掉,从服务器列表中删除Follwer。
initLimit=10 # 投票选举新leader的初始化时间。
tickTime=2000 # Zookeeper服务器心跳时间,单位毫秒
clientPort=2181 # 连接端口
dataDir=/home/Hadoop/zookeeper/data # 数据持久化路径
dataLogDir=/home/Hadoop/zookeeper/log # 日志保存路径
server.1=10.10.100.10:2888:3888

设置环境变量:

hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ export ZOOKEEPER_HOME=/home/Hadoop/zookeeper
hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ export PATH=$PATH:$ZOOKEEPER_HOME/bin

启动zookeeper:

hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ cd .
hongdada@ubuntu:/home/Hadoop/zookeeper/conf$ cd ../
hongdada@ubuntu:/home/Hadoop/zookeeper$ cd bin
hongdada@ubuntu:/home/Hadoop/zookeeper/bin$ zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/Hadoop/zookeeper/bin/../conf/zoo.cfg
mkdir: 无法创建目录"/home/Hadoop/zookeeper/data # 数据持久化路径": 权限不够
Starting zookeeper ... /home/Hadoop/zookeeper/bin/zkServer.sh: 行 140: ./zookeeper.out: 权限不够
/home/Hadoop/zookeeper/bin/zkServer.sh: 行 149: /home/Hadoop/zookeeper/data # 数据持久化路径/zookeeper_server.pid: 没有那个文件或目录
FAILED TO WRITE PID
hongdada@ubuntu:/home/Hadoop/zookeeper/bin$ sudo zkServer.sh start
[sudo] hongdada 的密码:
sudo: zkServer.sh:找不到命令
hongdada@ubuntu:/home/Hadoop/zookeeper/bin$ sudo ./zkServer.sh start
ZooKeeper JMX enabled by default
Using config: /home/Hadoop/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED

启动是./zkServer.sh start

http://jingyan.baidu.com/article/456c463b60bd380a5931446f.html

http://blog.csdn.net/cruise_h/article/details/19046357

Ubuntu 安装zookeeper的更多相关文章

  1. Ubuntu安装zookeeper问题

    在Ubuntu系统安装zookeeper后,启动报错: root@host8:/usr/solrcould/service1/zookeeper-3.5.0-alpha# sh bin/zkServe ...

  2. Linux系统Ubuntu安装zookeeper

    1. 下载zookeeper二进制安装包 下载地址:http://apache.dataguru.cn/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz ...

  3. Mac OS、Ubuntu 安装及使用 Consul

    Consul 概念(摘录): Consul 是 HashiCorp 公司推出的开源工具,用于实现分布式系统的服务发现与配置.与其他分布式服务注册与发现的方案,比如 Airbnb 的 SmartStac ...

  4. Ubuntu 13 Zookeeper 集群配置

    一. 目标 在Linux集群搭建Zookeeper集群,并配置管理Web管理系统. 二. 先决条件 本文档中基于VirtualBox Ubuntu Server 13.04 虚机(启动SSH服务器)构 ...

  5. Ubuntu安装部署Kafka

    Ubuntu安装部署Kafka 环境: Ubuntu 18.04.4 LTS ,JDK1.8,kafka_2.12-2.3.1 确保已经安装了JDK,JDK安装过程不再赘述.可参考文章xxxx 一.下 ...

  6. ubuntu安装mysql

    好记性不如烂笔头,记录一下,ubuntu安装mysql的指令. 安装MySQL: sudo apt-get install mysql-server sudo apt-get install mysq ...

  7. ubuntu安装vim时提示 没有可用的软件包 vim,但是它被其它的软件包引用了 解决办法

    ubuntu安装vim时提示 没有可用的软件包 vim-gtk3,但是它被其它的软件包引用了 解决办法 本人在ubuntu系统安装vim  输入 sudo apt-get install vim 提示 ...

  8. docker 1.8+之后ubuntu安装指定版本docker-engine

    这边记录ubuntu安装过程,首先是官网文档 If you haven’t already done so, log into your Ubuntu instance. Open a termina ...

  9. Eclipse安装ZooKeeper插件

    Eclipse在线安装插件奇慢的解决办法 安装ZooKeeper插件步骤如下:Step 1. 在 Eclipse 菜单打开Help -> Install New Software…Step 2. ...

随机推荐

  1. LeetCode——Basic Calculator II

    Description: Implement a basic calculator to evaluate a simple expression string. The expression str ...

  2. api静态化预案

    1.之前听到api静态化预案,一直以为是前端发送api请求,如果api请求失败,则再次发送一条请求,去请求备份的静态资源. 2.前两天了解到的api静态化预案是这样的:在请求api时,给api请求加上 ...

  3. 图片文字混排的垂直居中、inline-block块元素和行内元素混排的垂直居中问题

    图片.文字混排: 不管图片和文字的前后位置,都要给 图片 设置 vertical-algin,而不是谁在前面给谁设置. 此方法兼容IE7+ 和其它主流浏览器.IE7-没有测. inline-block ...

  4. java如何使用base64生成图片文件

    import org.apache.commons.codec.binary.Base64; public static void decodeFile(String base64Str,File f ...

  5. java获取年份的第一天和最后一天

    Calendar cal = Calendar.getInstance();cal.set(Calendar.MONTH, 0);cal.set(Calendar.DATE, 1);String da ...

  6. kafka简介【转】

    一.为什么需要消息系统 () 解耦 在项目启动之初来预测将来项目会碰到什么需求,是极其困难的.消息系统在处理过程中间插入了一个隐含的.基于数据的接口层,两边的处理过程都要实现这一接口.这允许你独立的扩 ...

  7. talib 中文文档(十一):Cycle Indicator Functions 周期指标

    Cycle Indicator Functions 不是很懂,欢迎指教 HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period 函数名:HT_D ...

  8. HTTP的常见状态码

    一.1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态码. 100(继续) 请求者应当继续提出请求.服务器返回此代码表示已收到请求的第一部分,正在等待其余部分. 101(切换协议) 请求者 ...

  9. atime、mtime、ctime的区别及如何降低atime更新 mount时的option noatime

    atime.mtime.ctime的区别及如何降低atime更新 mount时的option  noatime http://mp.weixin.qq.com/s?__biz=MzA3MzYwNjQ3 ...

  10. grep命令做永久别名 显示颜色

    grep命令做永久别名  显示颜色 http://jingyan.baidu.com/article/22fe7ced17c1543002617f9c.htmlhttp://blog.csdn.net ...