zoukankan      html  css  js  c++  java
  • Linux安装zookeeper

    一、前提条件

    JDK1.7+

    Hadoop 2.5.0+

    Zookeeper 3.4.5+

    下面介绍一下Zookeeper的安装:

    (1)到Zookeeper官网下载Zookeeper最新安装包,

    下载地址:http://mirrors.shu.edu.cn/apache/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz

    (2)下载完成后使用命令 tar -zxvf zookeeper-3.4.11.tar.gz进行解压

    (3)然后切换到其conf目录下

    使用vim zoo.cfg新建一个配置文件。内容如下:

    1.  
      # The number of milliseconds of each tick
    2.  
      tickTime=2000
    3.  
      # The number of ticks that the initial
    4.  
      # synchronization phase can take
    5.  
      initLimit=10
    6.  
      # The number of ticks that can pass between
    7.  
      # sending a request and getting an acknowledgement
    8.  
      syncLimit=5
    9.  
      # the directory where the snapshot is stored.
    10.  
      # do not use /tmp for storage, /tmp here is just
    11.  
      # example sakes.
    12.  
      dataDir=/home/chenjie/zookeeper-3.4.11/tmp
    13.  
      # the port at which the clients will connect
    14.  
      clientPort=2181
    15.  
      # the maximum number of client connections.
    16.  
      # increase this if you need to handle more clients
    17.  
      #maxClientCnxns=60
    18.  
      #
    19.  
      # Be sure to read the maintenance section of the
    20.  
      # administrator guide before turning on autopurge.
    21.  
      #
    22.  
      # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
    23.  
      #
    24.  
      # The number of snapshots to retain in dataDir
    25.  
      #autopurge.snapRetainCount=3
    26.  
      # Purge task interval in hours
    27.  
      # Set to "0" to disable auto purge feature
    28.  
      #autopurge.purgeInterval=1
    29.  
      server.1=pc2:2888:3888
    30.  
      server.2=pc3:2888:3888
    31.  
      server.3=pc4:2888:3888

    其中的主要配置项有

    dataDir=/home/chenjie/zookeeper-3.4.11/tmp
    1.  
      server.1=pc2:2888:3888
    2.  
      server.2=pc3:2888:3888
    3.  
      server.3=pc4:2888:3888

    dataDir是指定zookeeper的数据目录,在此我设置在了zookeeper根目录下的tmp目录下(此目录不存在,需要使用mkdir tmp创建)

    类似于

    server.1=pc2:2888:3888

    是配置zookeeper的节点,有多少个节点就配置多少个server,依次为server.1、server.2。。。pc2、pc3、pc4为各节点的主机名。

    (4)配置完成后,切换到刚才配置的dataDir下,在此目录下新建一个myid文件(使用命令 vim myid)

    进入vim后按i进入编辑模式,输入当前节点的编号(server.1的编号为1,依次类推),按esc推出编辑模式,输入shift + : 然后输入wq回车保存退出。

    (5)使用命令scp -r zookeeper-3.4.11 chenjie@pc3:/home/chenjie将刚才配置好的zookeeper发送到另外两个节点上。

    【然后修改另外两台节点上的dataDir/myid中的id为它们各自的id】

    (6)切换到bin目录下,使用命令启动zookeeper

    如果出现启动不了的情况,记得关闭防火墙

    因为防火墙没有关闭。关闭防火墙:

      #查看防火墙状态

       sudo service iptables status 

      #关闭防火墙
       sudo service iptables stop
      #查看防火墙开机启动状态
       sudo chkconfig iptables --list
      #关闭防火墙开机启动
       sudo chkconfig iptables off

  • 相关阅读:
    部署kube-prometheus,添加邮件报警
    kubernetes1.8开启swagger-ui
    使用alien命令让deb包和rpm包互相转换
    debian开启cgroup memory子系统
    debian9使用systemd部署etcd集群
    装饰器
    mysql根据经纬度求两地距离
    使用rem编写自适应屏幕网页造成div被span撑高的解决办法
    java绘图合并图像AlphaComposite模式测试
    spring data jpa查询部分字段、多余附加字段
  • 原文地址:https://www.cnblogs.com/XiaoLaiTongXueA/p/13644260.html
Copyright © 2011-2022 走看看