zoukankan      html  css  js  c++  java
  • ZK HBASE HDFS 常用CLI

    ZOOKEEPER

    zkServer.sh查看基本信息 status

    [root@hmaster ~]# find / -name zkServer.sh
    /opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/zkServer.sh
    find: `/proc/7410': No such file or directory
    
    [root@hmaster ~]# /opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/zkServer.sh status
    JMX enabled by default
    Using config: /opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../conf/zoo.cfg
    Mode: leader

    zkCli.sh  client连接server

    [root@hmaster ~]# find / -name zkCli.sh
    /opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/zkCli.sh
    
    [root@hmaster ~]# /opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/zkCli.sh -server localhost:2181
    Connecting to localhost:2181
    2016-11-29 09:45:52,351 [myid:] - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.5-cdh5.4.7--1, built on 09/17/2015 09:14 GMT
    2016-11-29 09:45:52,359 [myid:] - INFO  [main:Environment@100] - Client environment:host.name=hmaster.hillstonenet.com
    2016-11-29 09:45:52,359 [myid:] - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_65
    2016-11-29 09:45:52,364 [myid:] - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
    2016-11-29 09:45:52,365 [myid:] - INFO  [main:Environment@100] - Client environment:java.home=/usr/local/jdk1.8.0_65/jre
    2016-11-29 09:45:52,365 [myid:] - INFO  [main:Environment@100] - Client environment:java.class.path=/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../build/classes:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../build/lib/*.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../lib/slf4j-log4j12.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../lib/slf4j-log4j12-1.7.5.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../lib/slf4j-api-1.7.5.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../lib/netty-3.2.2.Final.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../lib/log4j-1.2.16.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../lib/jline-2.11.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../zookeeper-3.4.5-cdh5.4.7.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../src/java/lib/*.jar:/opt/cloudera/parcels/CDH-5.4.7-1.cdh5.4.7.p0.3/lib/zookeeper/bin/../conf:
    2016-11-29 09:45:52,365 [myid:] - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
    2016-11-29 09:45:52,366 [myid:] - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
    2016-11-29 09:45:52,366 [myid:] - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
    2016-11-29 09:45:52,366 [myid:] - INFO  [main:Environment@100] - Client environment:os.name=Linux
    2016-11-29 09:45:52,367 [myid:] - INFO  [main:Environment@100] - Client environment:os.arch=amd64
    2016-11-29 09:45:52,367 [myid:] - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-504.el6.x86_64
    2016-11-29 09:45:52,367 [myid:] - INFO  [main:Environment@100] - Client environment:user.name=root
    2016-11-29 09:45:52,367 [myid:] - INFO  [main:Environment@100] - Client environment:user.home=/root
    2016-11-29 09:45:52,368 [myid:] - INFO  [main:Environment@100] - Client environment:user.dir=/root
    2016-11-29 09:45:52,372 [myid:] - INFO  [main:ZooKeeper@645] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@506c589e
    Welcome to ZooKeeper!
    2016-11-29 09:45:52,427 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1061] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
    JLine support is enabled
    2016-11-29 09:45:52,641 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@938] - Socket connection established, initiating session, client: /127.0.0.1:38419, server: localhost/127.0.0.1:2181
    2016-11-29 09:45:52,661 [myid:] - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1321] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x358aa131fd405d6, negotiated timeout = 30000
    
    WATCHER::
    
    WatchedEvent state:SyncConnected type:None path:null

    zookeeper cli的所有命令

    [zk: localhost:2181(CONNECTED) 0] ?
    ZooKeeper -server host:port cmd args
        stat path [watch]
        set path data [version]
        ls path [watch]
        delquota [-n|-b] path
        ls2 path [watch]
        setAcl path acl
        setquota -n|-b val path
        history 
        redo cmdno
        printwatches on|off
        delete path [version]
        sync path
        listquota path
        rmr path
        get path [watch]
        create [-s] [-e] path data acl
        addauth scheme auth
        quit 
        getAcl path
        close 
        connect host:port

    zookeeper cli demo 查看hbase的znode信息

    [zk: localhost:2181(CONNECTED) 0] ls /
    [hillstone, zookeeper, hbase]
    [zk: localhost:2181(CONNECTED) 1] ls /hbase
    [replication, meta-region-server, rs, splitWAL, backup-masters, table-lock, flush-table-proc, region-in-transition, online-snapshot, master, running, recovering-regions, draining, namespace, hbaseid, table]
    
    [zk: localhost:2181(CONNECTED) 12] ls2 /hbase
    [replication, meta-region-server, rs, splitWAL, backup-masters, table-lock, flush-table-proc, region-in-transition, online-snapshot, master, running, recovering-regions, draining, namespace, hbaseid, table]
    cZxid = 0x100000004
    ctime = Mon Nov 28 16:37:08 CST 2016
    mZxid = 0x100000004
    mtime = Mon Nov 28 16:37:08 CST 2016
    pZxid = 0x100000047
    cversion = 16
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x0
    dataLength = 0
    numChildren = 16
    
    [zk: localhost:2181(CONNECTED) 15] get /hbase/meta-region-server
    �regionserver:60020�Y?�5PBUF
    '
    datanode2.hillstonenet.com�����Њ+ 
    cZxid = 0x100000039
    ctime = Mon Nov 28 16:37:18 CST 2016
    mZxid = 0x100000039
    mtime = Mon Nov 28 16:37:18 CST 2016
    pZxid = 0x100000039
    cversion = 0
    dataVersion = 0
    aclVersion = 0
    ephemeralOwner = 0x0
    dataLength = 80
    numChildren = 0
    [zk: localhost:2181(CONNECTED) 16] quit
    Quitting...
    2016-11-29 09:58:33,576 [myid:] - INFO  [main-EventThread:ClientCnxn$EventThread@532] - EventThread shut down
    2016-11-29 09:58:33,577 [myid:] - INFO  [main:ZooKeeper@891] - Session: 0x358aa131fd405d6 closed
    [root@hmaster ~]# 
  • 相关阅读:
    二叉树中序遍历及后序遍历(下)
    完全二叉树和三序遍历算法(先序)(上)
    分布式调度——zookeeper
    Linux版JDK环境安装
    Redis的事务
    Redis的持久化——RDB与AOF
    分布式缓存——Redis
    非关系型数据库
    分布式存储——MySQL
    分布式系统
  • 原文地址:https://www.cnblogs.com/AlexBai326/p/6112496.html
Copyright © 2011-2022 走看看