zookeeper数据存储及查看hbase信息
1.zookeeper数据存储:
1.1内存数据存储、磁盘数据存储.
内存数据存储:
数据模型是一棵树。包括所有节点路径,节点信息,ACL等。
DataTree:所有节点信息
DataNode:数据存储最小单元
1.2磁盘数据存储:
目录在配置zookeeper的文件中。
ls /tmp/zookeeper/
myid version-2/zookeeper_server.pid
其中version-2是事务日志格式版本号,内部文件为事务日志
ls /tmp/zookeeper/version-2/
acceptedEpoch currentEpoch log.100000001 log.200000001 snapshot.100000000
查看日志:java -cp ..jar org.apache.zookeeper.server.LogFormatter /tmp/zookeeper/version-2/log.100000001
1.3其中snapshot.100000000为某一时刻的全量内存数据内容
2.zookeeper-shell命令式使用:
进入zookeeper:/zookeeper/bin/zkCli.sh
查看使用命令:help
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
ls:查看当前 ZooKeeper 中所包含的内容
ls2:查看当前节点数据并能看到更新次数等数据
create:创建一个新的 znode
get:获取znode数据信息
rmr:删除该节点
...........
查看节点acl信息:
[zk: localhost:2181(CONNECTED) 16] getAcl /hbase
'world,'anyone
: cdrwa
查看zookeeper根目录存储:
ls /根目录:
zookeeper hbase两个节点
查看zookeeper节点目录
ls2 /zookeeper
[quota]
cZxid = 0x0
ctime = Thu Jan 01 08:00:00 CST 1970
mZxid = 0x0
mtime = Thu Jan 01 08:00:00 CST 1970
pZxid = 0x0
cversion = -1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1
查看hbase节点信息:
ls2 /hbasehbase节点
[replication, meta-region-server, rs, splitWAL, backup-masters, table-lock, flush-table-proc, region-in-transition, online-snapshot, switch, master, running, recovering-regions, draining, namespace, hbaseid, table]
cZxid = 0x100000002
ctime = Mon Nov 27 18:08:47 CST 2017
mZxid = 0x100000002
mtime = Mon Nov 27 18:08:47 CST 2017
pZxid = 0x200000430
cversion = 49
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 17
查看hbase集群在zookeeper记录的信息,比如:regionserver1-slave-1,regionserver2-slave-2
ls2 /hbase/rs
[slave-2,16020,1511853261863, slave-1,16020,1511853261718]
cZxid = 0x100000004
ctime = Mon Nov 27 18:08:47 CST 2017
mZxid = 0x100000004
mtime = Mon Nov 27 18:08:47 CST 2017
pZxid = 0x200000426
cversion = 22
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 2
表锁节点会有所有表。
[zk: localhost:2181(CONNECTED) 10] ls2 /hbase/table-lock
[dd, hbase:namespace]
cZxid = 0x100000009
ctime = Mon Nov 27 18:08:47 CST 2017
mZxid = 0x100000009
mtime = Mon Nov 27 18:08:47 CST 2017
pZxid = 0x20000046f
cversion = 23
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 23
查看所有表
[zk: localhost:2181(CONNECTED) 11] ls2 /hbase/table
[aa,hbase:meta, hbase:namespace]
cZxid = 0x100000006
ctime = Mon Nov 27 18:08:47 CST 2017
mZxid = 0x100000006
mtime = Mon Nov 27 18:08:47 CST 2017
pZxid = 0x200000478
cversion = 56
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 24
查看hbase的meta表信息,内涵server信息。
[zk: localhost:2181(CONNECTED) 14] get /hbase/table/hbase:meta
�master:16000�S�!��X�PBUF
cZxid = 0x200000034
ctime = Mon Nov 27 18:16:58 CST 2017
mZxid = 0x200000035
mtime = Mon Nov 27 18:16:58 CST 2017
pZxid = 0x200000034
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 31
numChildren = 0