zookeeper-3.7.0安装

zookeeper安装

1.解压
[root@hadoop001 /]# cd /usr/
[root@hadoop001 usr]# ls
bin  etc  games  hadoop330  include  java  lib  lib64  libexec  local  sbin  share  src  tmp
[root@hadoop001 usr]# mkdir zookeeper370
[root@hadoop001 usr]# ls
bin  etc  games  hadoop330  include  java  lib  lib64  libexec  local  sbin  share  src  tmp  zookeeper370
[root@hadoop001 usr]# cd ..
[root@hadoop001 /]# cd /opt/
[root@hadoop001 opt]# ls
apache-hive-3.1.2-bin.tar.gz       hbase-2.4.2-bin.tar.gz  VMwareTools-10.3.21-14772444.tar.gz
apache-zookeeper-3.7.0-bin.tar.gz  rh                      vmware-tools-distrib
[root@hadoop001 opt]# tar -zxvf apache-zookeeper-3.7.0-bin.tar.gz -C /usr/zookeeper370
其他两台操作一样
2.如果不是root需要修改hadoop主机的权限
[root@hadoop001 opt]# sudo chown -R hadoop:hadoop /usr/zookeeper370/apache-zookeeper-3.7.0-bin/
3.配置服务器编号
[root@hadoop001 apache-zookeeper-3.7.0-bin]# mkdir -p zkData
[root@hadoop001 apache-zookeeper-3.7.0-bin]# ls
bin  conf  docs  lib  LICENSE.txt  NOTICE.txt  README.md  README_packaging.md  zkData
[root@hadoop001 apache-zookeeper-3.7.0-bin]# cd zkData/
[root@hadoop001 zkData]# touch myid
[root@hadoop001 zkData]# vi myid 
[root@hadoop001 zkData]# cat myid 
001

其他两台002,003
[root@hadoop002 apache-zookeeper-3.7.0-bin]# cd zkData/
[root@hadoop002 zkData]# touch myid
[root@hadoop002 zkData]# vi myid 
[root@hadoop002 zkData]# cat myid 
002


[root@hadoop003 apache-zookeeper-3.7.0-bin]# cd zkData/
[root@hadoop003 zkData]# touch myid
[root@hadoop003 zkData]# vi myid 
[root@hadoop003 zkData]# cat myid 
003
添加环境变量
[root@hadoop001 etc]# vi /etc/profile

#zookeeper3.7.0
export ZOOKEEPER_HOME=/usr/zookeeper370/apache-zookeeper-3.7.0-bin
export PATH=$ZOOKEEPER_HOME/bin:$PATH

[root@hadoop001 ~]# source /etc/profile
[root@hadoop001 etc]# 

[root@hadoop001 conf]# scp -r /etc/profile root@hadoop002:/etc/

[root@hadoop002 conf]# source /etc/profile

[root@hadoop001 conf]# scp -r /etc/profile root@hadoop003:/etc/

[root@hadoop003 conf]# source /etc/profile
4.修改配置文件
[root@hadoop001 apache-zookeeper-3.7.0-bin]# cd /usr/zookeeper370/apache-zookeeper-3.7.0-bin/conf/
[root@hadoop001 conf]# ls
configuration.xsl  log4j.properties  zoo_sample.cfg
[root@hadoop001 conf]# cp zoo_sample.cfg zoo.cfg
[root@hadoop001 conf]# vim zoo.cfg
[root@hadoop001 conf]# cat 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=/usr/zookeeper370/apache-zookeeper-3.7.0-bin/zkData
dataLogDir=/usr/zookeeper370/apache-zookeeper-3.7.0-bin/tmp/logs

##########cluster##########
server.001=hadoop001:2888:3888
server.002=hadoop002:2888:3888
server.003=hadoop003: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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

[root@hadoop001 conf]# 

[root@hadoop001 conf]# cd ..

[root@hadoop001 conf]# scp -r /usr/zookeeper370 root@hadoop002:/usr/
[root@hadoop001 conf]# scp -r /usr/zookeeper370 root@hadoop003:/usr/

[root@hadoop001 hbase-2.4.2]# scp -r /usr/hbase242 root@hadoop003:/usr/

5.集群操作
分别启动Zookeeper
查看状态
[root@hadoop001 apache-zookeeper-3.7.0-bin]# bin/zkServer.sh start
[root@hadoop001 apache-zookeeper-3.7.0-bin]# bin/zkServer.sh status
启动客户端
[root@hadoop001 apache-zookeeper-3.7.0-bin]# bin/zkCli.sh

#或者
[root@hadoop001 apache-zookeeper-3.7.0-bin]# bin/zkCli.sh -server localhost:2181

[zk: localhost:2181(CONNECTED) 0] help
[zk: localhost:2181(CONNECTED) 1] ls /
[zookeeper]

[zk: localhost:2181(CONNECTED) 2] ls2 /
ZooKeeper -server host:port -client-configuration properties-file cmd args
        addWatch [-m mode] path # optional mode is one of [PERSISTENT, PERSISTENT_RECURSIVE] - default is PERSISTENT_RECURSIVE
        addauth scheme auth
        close 
        config [-c] [-w] [-s]
        connect host:port
        create [-s] [-e] [-c] [-t ttl] path [data] [acl]
        delete [-v version] path
        deleteall path [-b batch size]
        delquota [-n|-b|-N|-B] path
        get [-s] [-w] path
        getAcl [-s] path
        getAllChildrenNumber path
        getEphemerals path
        history 
        listquota path
        ls [-s] [-w] [-R] path
        printwatches on|off
        quit 
        reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*]
        redo cmdno
        removewatches path [-c|-d|-a] [-l]
        set [-s] [-v version] path data
        setAcl [-s] [-v version] [-R] path acl
        setquota -n|-b|-N|-B val path
        stat [-w] path
        sync path
        version 
        whoami 
Command not found: Command not found ls2
[zk: localhost:2181(CONNECTED) 3] 


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值