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