WALs(HLog)  存储

HLog 存储位置是在,hbase配置目录下WALs目录,默认为 /hbase/WALs  与  /hbase/oldWALs

/hbase/WALs : 存储未过期的日志

/hbase/oldWALs : 存储已过期的日志

这里先查看WALs日志目录,目录格式为:hostname1 为 服务器hostname , 16020 为hbase 端口,1561747594397 为目录创建时间

drwxr-xr-x   - hbase hbase          0 2019-08-13 15:58 /hbase/WALs/hostname1,16020,1561747594397

Hbase WALs(HLog) 文件存储,查看_数据保存

 目录下存放着Hlog 

-rw-r--r--   2 hbase hbase  268440291 2019-08-13 15:58 /hbase/WALs/hostname1,16020,1561747594397/hostname1%2C16020%2C1561747594397.hostname1%2C16020%2C1561747594397.regiongroup-0.1565681614115

查看日志内容

hbase hlog -j /hbase/WALs/hostname1,16020,1561747594397/hostname1%2C16020%2C1561747594397.hostname1%2C16020%2C1561747594397.regiongroup-0.1565681614115

Hbase 2.0 之后使用

hbase wal -j /hbase/WALs/hostname1,16020,1561747594397/hostname1%2C16020%2C1561747594397.hostname1%2C16020%2C1561747594397.regiongroup-0.1565681614115

更多介绍参考:https://hbase.apache.org/book.html#wal

Deprecated in 1.0 admin commands have been removed.

The following commands that were deprecated in 1.0 have been removed. Where applicable the replacement command is listed.

  • The 'hlog' command has been removed. Downstream users should rely on the 'wal' command instead.

看下命令介绍:-j 以json输出,-p输出value值,默认是补输出value 

[root@hostname ~]# hbase wal 
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
usage: WAL <filename...> [-h] [-j] [-p] [-r <arg>] [-s <arg>] [-w <arg>]
 -h,--help             Output help message
 -j,--json             Output JSON
 -p,--printvals        Print values
 -r,--region <arg>     Region to filter by. Pass encoded region name; e.g.
                       '9192caead6a5a20acb4454ffbc79fa14'
 -s,--sequence <arg>   Sequence to filter by. Pass sequence number.
 -w,--row <arg>        Row to filter by. Pass row name.

Hlog查看 

hbase wal /hbase/WALs/hostname1,16020,1561747594397/hostname1%2C16020%2C1561747594397.hostname1%2C16020%2C1561747594397.regiongroup-0.1565681614115  | less 
row=d687aa8919594289543efde17047217b, column=fn:friends_count
row=d687aa8919594289543efde17047217b, column=fn:created_at
row=d687aa8919594289543efde17047217b, column=fn:description
row=d687aa8919594289543efde17047217b, column=fn:experience
row=d687aa8919594289543efde17047217b, column=fn:uid
row=d687aa8919594289543efde17047217b, column=fn:province
row=d687aa8919594289543efde17047217b, column=fn:zan_count
row=d687aa8919594289543efde17047217b, column=fn:verified_reason
row=d687aa8919594289543efde17047217b, column=fn:level_info
row=d687aa8919594289543efde17047217b, column=fn:reposts_count
row=d687aa8919594289543efde17047217b, column=fn:isRepeat
row=d687aa8919594289543efde17047217b, column=fn:profileImageUrl
row=d687aa8919594289543efde17047217b, column=fn:read_count
row=d687aa8919594289543efde17047217b, column=fn:growthSpeed
row=d687aa8919594289543efde17047217b, column=fn:verified
row=d687aa8919594289543efde17047217b, column=fn:verified_type
row=d687aa8919594289543efde17047217b, column=fn:growthValue
row=d687aa8919594289543efde17047217b, column=fn:url

 Hlog过期

当数据从memstore写入到磁盘中,Hlog就已经没有用了,会把/hbase/WALs目录下的数据移动到/hbase/oldWALs 目录下,oldWALs目录下的数据会根据 hbase.master.cleaner.interval (默认1分钟)配置的时间定期去检查,如发现有数据会清除,清除前还会检验一个参数 hbase.master.logcleaner.ttl ,也就是说数据保存1分钟以上才会删除,如果一分钟内数据直接从memstore写入到了磁盘,oldWALs下的数据也不会被删除

Hbase WALs(HLog) 文件存储,查看_数据保存_02