How To Change the replication of a Column family in HBase

668 Views Asked by At

The question is mainly about that, in my project, I want to create a table with 3 column family. the default replication number is 3. but I wanna change this replication number for centain column family, just because we dont need so much repliction for it.

for example, a table name table1, and has 3 column family, f1,f2,f3. In this case, we want to set the replication number of f3 is 1. so how can I set this config? Is there any solutions without change the source code?

PS: via hbase shell or JAVA?

2

There are 2 best solutions below

0
On

First we should specify that the term replication is a little overloaded.

HBase uses HDFS as it's storage. HDFS will replicate, to multiple DataNodes, the blocks that make up any files that HBase generates. (see http://hadoop.apache.org/docs/stable/hdfs_design.html#Data+Replication ) This value isn't configurable per column family, or table. It's only configurable per server. (See http://hbase.apache.org/book.html#hdfs_client_conf )

If this is something you'd like to change then I would suggest filing a jira requesting a new feature.

HBase also has the ability to replicate edits from one HBase cluster to another cluster. This replication is per write ahead log and is configurable per column family. Setting REPLICATION_SCOPE to one will tell HBase to apply the edits from this region server onto another cluster. Setting this to 0 will turn replication off.

1
On

i looked a lot on this. as i see it - you can not define different replication for a the tables, let alone for column family.

The number of replications is defined in the hbase-site.xml which is for the whole table. you can define if you want to replicate the column family or not using REPLICATION_SCOPE.