1、查看test表
2、查看Hadoop的日志文件信息
3、查看类
org.apache.hadoop.hbase.regionserver.wal.HLog功能
有2中功能,dump和split
4、dump WAL
slave3上的日志都是与mytab表相关的内容,slave2上的日志都是与test表相关的内容,而slave1没有任何信息。
5、使用参数-w过滤行
6、手工splitting WAL
注意查看上面标红的部分
7、再次查看Hbase文件的变化
可以看到slave2的WAL文件没有了,但是多出了ROOT和test表的recovered
.edits
8、查看recovered .edits文件的内容
从上面可以看出内容与splitting之前的内容一致。
- hbase(main):016:0> scan 'test'
- ROW COLUMN+CELL
- row-01 column=cf1:id, timestamp=1442020353563, value=1
- row-01 column=cf1:name, timestamp=1442020382276, value=aaa
- row-02 column=cf1:id, timestamp=1442020360143, value=2
- row-02 column=cf1:name, timestamp=1442020388494, value=bbb
- row-03 column=cf1:id, timestamp=1442020364496, value=3
- row-03 column=cf1:name, timestamp=1442020393616, value=ccc
- row-04 column=cf1:id, timestamp=1442020369002, value=4
- row-04 column=cf1:name, timestamp=1442020398557, value=ddd
- row-05 column=cf1:id, timestamp=1442020373493, value=5
- row-05 column=cf1:name, timestamp=1442020404131, value=eee
- 5 row(s) in 0.0550 seconds
- grid@master1:~$ hadoop fs -lsr /hbase
- .....................................
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:08 /hbase/.logs
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave1,60020,1442020081861
- -rw-r--r-- 3 grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave1,60020,1442020081861/slave1%2C60020%2C1442020081861.1442020084844
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave2,60020,1442020091201
- -rw-r--r-- 3 grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave3,60020,1442020081746
- -rw-r--r-- 3 grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave3,60020,1442020081746/slave3%2C60020%2C1442020081746.1442020084743
- .....................................
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog
- Usage: HLog <ARGS>
- Arguments:
- --dump Dump textual representation of passed one or more files
- For example: HLog --dump hdfs://example.com:9000/hbase/.logs/MACHINE/LOGFILE
- --split Split the passed directory of WAL logs
- For example: HLog --split hdfs://example.com:9000/hbase/.logs/DIR
4、dump WAL
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog --dump hdfs://master1:9000/hbase/.logs/slave3,60020,1442020081746/slave3%2C60020%2C1442020081746.1442020084743
- Sequence 99 from region 1028785192 in table .META.
- Action:
- row: mytab,,1442016078397.1a941894743e7186ab65f8c462d8e7f2.
- column: info:server
- at time: Sat Sep 12 01:08:11 UTC 2015
- Action:
- row: mytab,,1442016078397.1a941894743e7186ab65f8c462d8e7f2.
- column: info:serverstartcode
- at time: Sat Sep 12 01:08:11 UTC 2015
- Sequence 100 from region 1028785192 in table .META.
- Action:
- row: mytab,90,1442016078397.c9393e0daec64352e7c8e541c8b2dce3.
- column: info:server
- at time: Sat Sep 12 01:08:11 UTC 2015
- Action:
- row: mytab,90,1442016078397.c9393e0daec64352e7c8e541c8b2dce3.
- column: info:serverstartcode
- at time: Sat Sep 12 01:08:11 UTC 2015
- ....................................................................
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog --dump hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247
- Sequence 68 from region 70236052 in table -ROOT-
- Action:
- row: .META.,,1
- column: info:server
- at time: Sat Sep 12 01:08:10 UTC 2015
- Action:
- row: .META.,,1
- column: info:serverstartcode
- at time: Sat Sep 12 01:08:10 UTC 2015
- Sequence 95 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-01
- column: cf1:id
- at time: Sat Sep 12 01:12:33 UTC 2015
- Sequence 96 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-02
- column: cf1:id
- at time: Sat Sep 12 01:12:40 UTC 2015
- Sequence 97 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-03
- column: cf1:id
- at time: Sat Sep 12 01:12:44 UTC 2015
- Sequence 98 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-04
- column: cf1:id
- at time: Sat Sep 12 01:12:49 UTC 2015
- ....................................................................
- Sequence 105 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: METAROW
- column: METAFAMILY:
- at time: Sat Sep 12 01:13:39 UTC 2015
5、使用参数-w过滤行
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog --dump hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247 -p -w 'row-01'
- Sequence 95 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-01
- column: cf1:id
- at time: Sat Sep 12 01:12:33 UTC 2015
- value: 1
- Sequence 100 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-01
- column: cf1:name
- at time: Sat Sep 12 01:13:02 UTC 2015
- value: aaa
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog --split hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201
- 15/09/12 01:41:09 INFO wal.HLogSplitter: Splitting 1 hlog(s) in hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201
- 15/09/12 01:41:09 DEBUG wal.HLogSplitter: Writer thread Thread[WriterThread-0,5,main]: starting
- 15/09/12 01:41:09 DEBUG wal.HLogSplitter: Writer thread Thread[WriterThread-1,5,main]: starting
- 15/09/12 01:41:09 DEBUG wal.HLogSplitter: Writer thread Thread[WriterThread-2,5,main]: starting
- 15/09/12 01:41:09 INFO wal.HLogSplitter: Splitting hlog 1 of 1: hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247, length=0
- 15/09/12 01:41:09 WARN wal.HLogSplitter: File hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247 might be still open, length is 0
- 15/09/12 01:41:09 INFO util.FSHDFSUtils: Recovering lease on dfs file hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247
- 15/09/12 01:41:09 INFO util.FSHDFSUtils: recoverLease=false, attempt=0 on file=hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247 after 2ms
- 15/09/12 01:41:12 INFO util.FSHDFSUtils: recoverLease=true, attempt=1 on file=hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247 after 3005ms
- 15/09/12 01:41:12 DEBUG wal.HLogSplitter: Pushed=12 entries from hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247
- 15/09/12 01:41:12 INFO wal.HLogSplitter: Waiting for split writer threads to finish
- 15/09/12 01:41:12 INFO util.FSUtils: FileSystem doesn't support getDefaultReplication
- 15/09/12 01:41:12 INFO util.FSUtils: FileSystem doesn't support getDefaultBlockSize
- 15/09/12 01:41:12 INFO util.FSUtils: FileSystem doesn't support getDefaultReplication
- 15/09/12 01:41:12 INFO util.FSUtils: FileSystem doesn't support getDefaultBlockSize
- 15/09/12 01:41:12 DEBUG wal.SequenceFileLogWriter: using new createWriter -- HADOOP-6840
- 15/09/12 01:41:12 DEBUG wal.SequenceFileLogWriter: using new createWriter -- HADOOP-6840
- 15/09/12 01:41:12 DEBUG wal.SequenceFileLogWriter: Path=hdfs://master1:9000/hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000095.temp, syncFs=true, hflush=false, compression=false
- 15/09/12 01:41:12 DEBUG wal.SequenceFileLogWriter: Path=hdfs://master1:9000/hbase/-ROOT-/70236052/recovered.edits/0000000000000000068.temp, syncFs=true, hflush=false, compression=false
- 15/09/12 01:41:12 DEBUG wal.HLogSplitter: Creating writer path=hdfs://master1:9000/hbase/-ROOT-/70236052/recovered.edits/0000000000000000068.temp region=70236052
- 15/09/12 01:41:12 DEBUG wal.HLogSplitter: Creating writer path=hdfs://master1:9000/hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000095.temp region=5cd0e6afea7d7843a5d28d922d6193f0
- 15/09/12 01:41:12 INFO wal.HLogSplitter: Split writers finished
- 15/09/12 01:41:12 INFO wal.HLogSplitter: Closed path hdfs://master1:9000/hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000095.temp (wrote 11 edits in 304ms)
- 15/09/12 01:41:12 INFO wal.HLogSplitter: Closed path hdfs://master1:9000/hbase/-ROOT-/70236052/recovered.edits/0000000000000000068.temp (wrote 1 edits in 305ms)
- 15/09/12 01:41:12 DEBUG wal.HLogSplitter: Rename hdfs://master1:9000/hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000095.temp to hdfs://master1:9000/hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000105
- 15/09/12 01:41:12 DEBUG wal.HLogSplitter: Rename hdfs://master1:9000/hbase/-ROOT-/70236052/recovered.edits/0000000000000000068.temp to hdfs://master1:9000/hbase/-ROOT-/70236052/recovered.edits/0000000000000000068
- 15/09/12 01:41:12 DEBUG wal.HLogSplitter: Archived processed log hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201/slave2%2C60020%2C1442020091201.1442020094247 to hdfs://master1:9000/hbase/.oldlogs/slave2%2C60020%2C1442020091201.1442020094247
- 15/09/12 01:41:12 INFO wal.HLogSplitter: hlog file splitting completed in 3576 ms for hdfs://master1:9000/hbase/.logs/slave2,60020,1442020091201
7、再次查看Hbase文件的变化
- grid@master1:~$ hadoop fs -lsr /hbase
- ..............................................................
- drwxr-xr-x - grid supergroup 0 2015-09-11 23:05 /hbase/-ROOT-/70236052/info
- -rw-r--r-- 3 grid supergroup 800 2015-09-11 23:05 /hbase/-ROOT-/70236052/info/17a565df18804731b4eb38bdcc95c262
- -rw-r--r-- 3 grid supergroup 1596 2015-09-11 19:21 /hbase/-ROOT-/70236052/info/924e206e22754690b08c8ec8bbf84692
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:41 /hbase/-ROOT-/70236052/recovered.edits
- -rw-r--r-- 2 grid supergroup 303 2015-09-12 01:41 /hbase/-ROOT-/70236052/recovered.edits/0000000000000000068
- .................................................................
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:41 /hbase/.logs
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave1,60020,1442020081861
- -rw-r--r-- 3 grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave1,60020,1442020081861/slave1%2C60020%2C1442020081861.1442020084844
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave3,60020,1442020081746
- -rw-r--r-- 3 grid supergroup 0 2015-09-12 01:08 /hbase/.logs/slave3,60020,1442020081746/slave3%2C60020%2C1442020081746.1442020084743
- .................................................................
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:15 /hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/cf1
- -rw-r--r-- 3 grid supergroup 954 2015-09-12 01:15 /hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/cf1/6e4df2f70b504d0d87507b7152e2de39
- drwxr-xr-x - grid supergroup 0 2015-09-12 01:41 /hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits
- -rw-r--r-- 2 grid supergroup 1408 2015-09-12 01:41 /hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000105
8、查看recovered .edits文件的内容
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog --dump hdfs://master1:9000/hbase/test/5cd0e6afea7d7843a5d28d922d6193f0/recovered.edits/0000000000000000105
- Sequence 95 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-01
- column: cf1:id
- at time: Sat Sep 12 01:12:33 UTC 2015
- Sequence 96 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-02
- column: cf1:id
- at time: Sat Sep 12 01:12:40 UTC 2015
- Sequence 97 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: row-03
- column: cf1:id
- at time: Sat Sep 12 01:12:44 UTC 2015
- ......................................................................
- Sequence 105 from region 5cd0e6afea7d7843a5d28d922d6193f0 in table test
- Action:
- row: METAROW
- column: METAFAMILY:
- at time: Sat Sep 12 01:13:39 UTC 2015
- grid@master1:~$ hbase org.apache.hadoop.hbase.regionserver.wal.HLog --dump hdfs://master1:9000/hbase/-ROOT-/70236052/recovered.edits/0000000000000000068
- Sequence 68 from region 70236052 in table -ROOT-
- Action:
- row: .META.,,1
- column: info:server
- at time: Sat Sep 12 01:08:10 UTC 2015
- Action:
- row: .META.,,1
- column: info:serverstartcode
- at time: Sat Sep 12 01:08:10 UTC 2015
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12219480/viewspace-1797992/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12219480/viewspace-1797992/