2
votes

I knew Hbase has replicates of WAL and Hfile, but all of these are stored in HDFS as persistence. So will Hbase also provides region level replicas. We know Region contains BlockCache and MemCache, if only one Region instance handle requests, how does Hbase solve the hot point requests.

Additionally, if only one region instance, Hbase would be always consistency, right please? Because all readers just read from the one region, they always see the same data? Thanks!

1

1 Answers

3
votes

Latest versions of HBase has a feature called “region replication”.

For each region of a table, there can be multiple replicas that are opened in different Region Servers. By default, the region replication is set to 1, so only a single region replica is deployed and there are no changes from the original model. If region replication is set to 2 or more, then the master assigns replicas of the regions of the table. The Load Balancer ensures that the region replicas are not co-hosted in the same Region Servers and also in the same rack (if possible).

To enable, Set hbase.region.replica.replication.enabled to true in hbase-site.xml.

Creating tables with High Availability of regions:

CREATE 't1', 'f1', {REGION_REPLICATION => 2}

HBase provides consistency model for get or scan operations.

public enum Consistency {
   STRONG,
   TIMELINE
 }

Consistency.STRONG is the default consistency model provided by HBase. If a table has region replication = 1, or has region replicas but the reads are done with time consistency enabled, the read is always performed by the primary regions

Querying secondary regions:

Get get = new Get(row); 
get.setConsistency(CONSISTENCY.TIMELINE);
...
Result result = table.get(get); 

For scan

scan 't1', {CONSISTENCY => 'TIMELINE'}

For more details, you can refer to this