下载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. webpack之跨域

    前后端分离开发中,本地前端开发调用接口会有跨域问题,一般有以下几种解决方法: 直接启动服务端项目,再将项目中的资源url指向到前端服务中的静态资源地址,好处在于因为始终在服务端的环境中进行资源调试,不 ...

  2. Python class的属性访问控制和内建函数重写实现高级功能以及@property

    一.类属性的访问控制 Python Class确实是博大精深,我们还是来温习一下属性的访问控制作为开(fu)场(xi). 首先_varname是可以访问的,__varname是不能直接访问(原理是__ ...

  3. jquery背景backgroundPosition插件

    在jquery官网里找到(http://plugins.jquery.com/kbw.backgroundpos/) 语法: obj.animate({'background-position': ' ...

  4. This function has none of DETERMINISTIC, NO SQL

    错误信息: [Err] 1418 - This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declara ...

  5. HDCMS导航高亮显示!解决办法

    第一种方法:(传递class) <channel type='top' row='8' class='cur' > <li class='{$field.class}'> &l ...

  6. nginx解决带_的head内容丢失

    若请求 Head 信息中存在自定义信息并且以 "_" 下划线间隔,则必须配置underscores_in_headers 否则 Head 无法向 Tomcat 转发 解决办法: 在 ...

  7. 终于修好了MacBook

    之前由于Trackpad故障,陆家嘴苹果店开了维修单,让我在2周内去更换,详见第二次去苹果店维修MacBook. 后来由于购买了AppleCare进行延保,又担心放在那维修时间长,就懒得去更换了. 昨 ...

  8. java 入门基础学习

    问题一:java编写的源代码为什么能在windows/linux/macOS操作系统运行?运行原理是什么?为什么说它是跨平台的? 从jdk/jvm/jre说起 1.JDK简介 https://blog ...

  9. arpa/inet.h所引起的Segmentation fault及网络编程常见的头文件

    最近在学习Linux网络编程方面的知识,感觉还是有些困难.主要是对协议过程的理解,还有socket的API的理解不够深刻.今天复习编写了一个TCP的服务端和客户端的程序实现client.c从命令行参数 ...

  10. redhat 7.2 内网安装docker

    本文介绍在内网环境下如果通过网络代理映射来完成docekr的安装,首先在能上网的windows机器上安装squid,并启动,本实例中windows机器IP为 192.168.192.101 ,squi ...