Hbase table to modify existing compression

May encounter on the business case, create hbase table for the first time, the compression method is not specified when the data import, data caused by the expansion rowkey result in data size on hdfs much larger than the original data size. So this time may have to consider the use of compression, but if you delete the table, and then create a designated compressed table, and then re-import the data would be too time-consuming. Of course, not entirely so, you can modify the direct compression method hbase table, then you can execute major_compact

 

disable ' testcompression ' // first table offline 
ALTER ' testcompression ' , NAME => ' F1 ' , the COMPRESSION => ' Snappy ' // Modify table properties, compression is designated Snappy 
enable ' testcompression ' // enable table 

desc ' testcompression '// verify that compression is enabled presumptuous 
major_compact ' testcompression '// execute large merger

 

Some need to be aware of:

  1. After executing the alter, hbase table compression is enabled, but to the original list of existing data and does not compress the data before the implementation of the follow-up re-write of compression (hdfs to be verified)

  2. If you want the original table also use existing data compression, then you need to perform a major_compact. major_compact will re-read and write data, in this process, the original data is compressed, but if the table is big data execution major_compact have a relatively large impact on hbase cluster. If online environment, it is recommended to perform during the service is not busy.

Guess you like

Origin www.cnblogs.com/dtmobile-ksw/p/11371612.html