目录
一、获取 hbase:meta 表位于哪个 Region Server
二、查看在hbase上某一张表位于哪个 Region Server
三、-root-表与.meta.表关系
一、获取 hbase:meta 表位于哪个 Region Server
1、进入到zookeeper的bin目录
[root@bigdata02 zookeeper]# cd bin/
2、ll查看bin目录下的内容
[root@bigdata02 bin]# ll
total 164
-rwxrwxrwx 1 bigdata root 232 Mar 23 2017 README.txt
-rwxrwxrwx 1 bigdata root 1937 Mar 23 2017 zkCleanup.sh
-rwxrwxrwx 1 bigdata root 1056 Mar 23 2017 zkCli.cmd
-rwxrwxrwx 1 bigdata root 1534 Mar 23 2017 zkCli.sh
-rwxrwxrwx 1 bigdata root 1628 Mar 23 2017 zkEnv.cmd
-rwxrwxrwx 1 bigdata root 2696 Mar 23 2017 zkEnv.sh
-rwxrwxrwx 1 bigdata root 1089 Mar 23 2017 zkServer.cmd
-rwxrwxrwx 1 bigdata root 6773 Mar 23 2017 zkServer.sh
-rw-r--r-- 1 root root 93973 Feb 28 14:21 zookeeper.out
3、执行脚本zkCli.sh
[root@bigdata02 bin]# zkCli.sh
Connecting to localhost:2181
2021-02-28 14:22:59,603 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT
2021-02-28 14:22:59,605 [myid:] - INFO [main:Environment@100] - Client environment:host.name=bigdata02
2021-02-28 14:22:59,605 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_73
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:java.home=/usr/local/java/jdk1.8.0_73/jre
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=/home/bigdata/apps/zookeeper-3.4.10/bin/../build/classes:/home/bigdata/apps/zookeeper-3.4.10/bin/../build/lib/*.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../lib/slf4j-log4j12-1.6.1.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../lib/slf4j-api-1.6.1.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../lib/netty-3.10.5.Final.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../lib/log4j-1.2.16.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../lib/jline-0.9.94.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../zookeeper-3.4.10.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../src/java/lib/*.jar:/home/bigdata/apps/zookeeper-3.4.10/bin/../conf:.:/usr/local/java/jdk1.8.0_73/lib/dt.jar:/usr/local/java/jdk1.8.0_73/lib/tools.jar
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Linux
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:os.version=3.10.0-1062.el7.x86_64
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:user.name=root
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:user.home=/root
2021-02-28 14:22:59,607 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=/home/bigdata/apps/zookeeper-3.4.10/bin
2021-02-28 14:22:59,608 [myid:] - INFO [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@69d0a921
2021-02-28 14:22:59,632 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1032] - Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
Welcome to ZooKeeper!
JLine support is enabled
2021-02-28 14:22:59,751 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@876] - Socket connection established to localhost/127.0.0.1:2181, initiating session
2021-02-28 14:22:59,766 [myid:] - INFO [main-SendThread(localhost:2181):ClientCnxn$SendThread@1299] - Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x277e749974b0003, negotiated timeout = 30000
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
4、查看根目录
[zk: localhost:2181(CONNECTED) 0] ls /
[controller_epoch, brokers, zookeeper, admin, isr_change_notification, consumers, config, hbase]
5、查看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, switch, master, running, recovering-regions, draining, namespace, hbaseid, table]
6、查看meta-region-server内容
[zk: localhost:2181(CONNECTED) 3] get /hbase/meta-region-server
由结果可知“.meta.”表在 bigdata04上维护
7、可在HBase的web页面查看“.meta.”表位置
“.meta.”表在 bigdata04上维护。可以在hbase shell中扫描查看“.meta.”表的内容
二、查看在hbase上某一张表位于哪个 Region Server
1、在hbase shell查看meta存的内容
hbase(main):001:0> scan 'hbase:meta'
ROW COLUMN+CELL
hbase:namespace,,1602944672158.343c690e03ec column=info:regioninfo, timestamp=1614493272635, value={ENCODED => 343c690e03ecc6717046dfc4b5ca78f3, NAME => 'hbase:namespace,,1
c6717046dfc4b5ca78f3. 602944672158.343c690e03ecc6717046dfc4b5ca78f3.', STARTKEY => '', ENDKEY => ''}
hbase:namespace,,1602944672158.343c690e03ec column=info:seqnumDuringOpen, timestamp=1614493272635, value=\x00\x00\x00\x00\x00\x00\x00\x10
c6717046dfc4b5ca78f3.
hbase:namespace,,1602944672158.343c690e03ec column=info:server, timestamp=1614493272635, value=bigdata03:16020
c6717046dfc4b5ca78f3.
hbase:namespace,,1602944672158.343c690e03ec column=info:serverstartcode, timestamp=1614493272635, value=1614493261209
c6717046dfc4b5ca78f3.
stu,,1614005476276.321b759365fe8adc28c8deed column=info:regioninfo, timestamp=1614493272630, value={ENCODED => 321b759365fe8adc28c8deed71eb49c2, NAME => 'stu,,1614005476276
71eb49c2. .321b759365fe8adc28c8deed71eb49c2.', STARTKEY => '', ENDKEY => ''}
stu,,1614005476276.321b759365fe8adc28c8deed column=info:seqnumDuringOpen, timestamp=1614493272630, value=\x00\x00\x00\x00\x00\x00\x00\x07
71eb49c2.
stu,,1614005476276.321b759365fe8adc28c8deed column=info:server, timestamp=1614493272630, value=bigdata03:16020
71eb49c2.
stu,,1614005476276.321b759365fe8adc28c8deed column=info:serverstartcode, timestamp=1614493272630, value=1614493261209
71eb49c2.
stu2,,1614005733571.da1e8e6f15fa6e9e546351a column=info:regioninfo, timestamp=1614493272635, value={ENCODED => da1e8e6f15fa6e9e546351a2d494221a, NAME => 'stu2,,161400573357
2d494221a. 1.da1e8e6f15fa6e9e546351a2d494221a.', STARTKEY => '', ENDKEY => ''}
stu2,,1614005733571.da1e8e6f15fa6e9e546351a column=info:seqnumDuringOpen, timestamp=1614493272635, value=\x00\x00\x00\x00\x00\x00\x00\x10
2d494221a.
stu2,,1614005733571.da1e8e6f15fa6e9e546351a column=info:server, timestamp=1614493272635, value=bigdata03:16020
2d494221a.
stu2,,1614005733571.da1e8e6f15fa6e9e546351a column=info:serverstartcode, timestamp=1614493272635, value=1614493261209
2d494221a.
stu3,,1614167525023.e601f0d3cd83a7e4b2308db column=info:regioninfo, timestamp=1614493273069, value={ENCODED => e601f0d3cd83a7e4b2308db1f5fa7617, NAME => 'stu3,,161416752502
1f5fa7617. 3.e601f0d3cd83a7e4b2308db1f5fa7617.', STARTKEY => '', ENDKEY => ''}
stu3,,1614167525023.e601f0d3cd83a7e4b2308db column=info:seqnumDuringOpen, timestamp=1614493273069, value=\x00\x00\x00\x00\x00\x00\x00\x16
1f5fa7617.
stu3,,1614167525023.e601f0d3cd83a7e4b2308db column=info:server, timestamp=1614493273069, value=bigdata04:16020
1f5fa7617.
stu3,,1614167525023.e601f0d3cd83a7e4b2308db column=info:serverstartcode, timestamp=1614493273069, value=1614493261237
1f5fa7617.
stu4,,1614180730469.eae73660dd6bdd4a08ae1bf column=info:regioninfo, timestamp=1614493273143, value={ENCODED => eae73660dd6bdd4a08ae1bf59ef14bfd, NAME => 'stu4,,161418073046
59ef14bfd. 9.eae73660dd6bdd4a08ae1bf59ef14bfd.', STARTKEY => '', ENDKEY => ''}
stu4,,1614180730469.eae73660dd6bdd4a08ae1bf column=info:seqnumDuringOpen, timestamp=1614493273143, value=\x00\x00\x00\x00\x00\x00\x00\x0D
59ef14bfd.
stu4,,1614180730469.eae73660dd6bdd4a08ae1bf column=info:server, timestamp=1614493273143, value=bigdata04:16020
59ef14bfd.
stu4,,1614180730469.eae73660dd6bdd4a08ae1bf column=info:serverstartcode, timestamp=1614493273143, value=1614493261237
59ef14bfd.
student01,,1613994448058.f82ea5fbeb4f692465 column=info:regioninfo, timestamp=1614493273095, value={ENCODED => f82ea5fbeb4f692465eacddcb04095de, NAME => 'student01,,1613994
eacddcb04095de. 448058.f82ea5fbeb4f692465eacddcb04095de.', STARTKEY => '', ENDKEY => ''}
student01,,1613994448058.f82ea5fbeb4f692465 column=info:seqnumDuringOpen, timestamp=1614493273095, value=\x00\x00\x00\x00\x00\x00\x00\x04
eacddcb04095de.
student01,,1613994448058.f82ea5fbeb4f692465 column=info:server, timestamp=1614493273095, value=bigdata04:16020
eacddcb04095de.
student01,,1613994448058.f82ea5fbeb4f692465 column=info:serverstartcode, timestamp=1614493273095, value=1614493261237
eacddcb04095de.
6 row(s) in 0.4080 seconds
2、在“.meta.”表中查看“stu”表所在的region server
“stu”由bigdata03维护
3、在HBase页面查看“stu”表所在的region server位置
“stu”由bigdata03维护
三、-root-表与.meta.表关系
老版本中存了-root-表,如果有-root-表会把上面的信息往后面推一步。
在ZK中存的是-root-表的Region Server,-root-表表中存的是.meta.表的Region Server,.meta.表中存的是其它表的Region Server地址。
这样涉及是考虑到.meta.表以后有可能也会切分,在长期生产环境中.meta.表是不会切分的。一般在生产中,一张表存10G数据。
网友评论