如何使用 HBase shell 在 Bigtable 中设置 table 压缩模式?

How to set table compression mode in Bigtable using HBase shell?

我正在使用 HBase shell 在 Bigtable 中创建表,而您可以在其中指定压缩的常用 create table 命令显然会忽略压缩属性。

示例:

hbase(main):003:0> create 'table_snappy', {NAME => 'event', VERSIONS => 1, COMPRESSION => 'SNAPPY', BLOOMFILTER => 'ROW'}
hbase(main):004:0> describe 'table_snappy'
Table table_snappy is ENABLED
table_snappy
COLUMN FAMILIES DESCRIPTION
{NAME => 'event', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
1 row(s) in 0.0870 seconds

hbase(main):003:0> create 'table_lzo', {NAME => 'event', VERSIONS => 1, COMPRESSION => 'LZO', BLOOMFILTER => 'ROW'}
hbase(main):004:0> describe 'table_lzo'
Table table_lzo is ENABLED
table_lzo
COLUMN FAMILIES DESCRIPTION
{NAME => 'event', BLOOMFILTER => 'ROW', VERSIONS => '1', IN_MEMORY => 'false', KEEP_DELETED_CELLS => 'FALSE', DATA_BLOCK_ENCODING => 'NONE', TTL => 'FOREVER', COMPRESSION => 'NONE', MIN_VERSIONS => '0', BLOCKCACHE => 'true', BLOCKSIZE => '65536', REPLICATION_SCOPE => '0'}
1 row(s) in 0.0870 seconds

Bigtable 使用专有压缩算法,不公开压缩方法或配置。因此,虽然输入被忽略,但压缩正在发生并自动为您管理。

这记录在 Bigtable differences from HBase:

Column families

When you create a column family, you cannot configure the block size or compression method, either with the HBase shell or through the HBase API. Cloud Bigtable manages the block size and compression for you.

In addition, if you use the HBase shell to get information about a table, the HBase shell will always report that each column family does not use compression. In reality, Cloud Bigtable uses proprietary compression methods for all of your data.