W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
您可以使用Consistency.TIMELINE語義在shell中進行讀取,如下所示:
hbase(main):001:0> get 't1','r6', {CONSISTENCY => "TIMELINE"}
您可以模擬區(qū)域服務(wù)器暫停或變得不可用,并從輔助副本執(zhí)行讀取操作:
$ kill -STOP <pid or primary region server>
hbase(main):001:0> get 't1','r6', {CONSISTENCY => "TIMELINE"}
使用掃描也是類似的:
hbase> scan 't1', {CONSISTENCY => 'TIMELINE'}
您可以為Get和Scans設(shè)置一致性,并按如下方式執(zhí)行請求:
Get get = new Get(row);
get.setConsistency(Consistency.TIMELINE);
...
Result result = table.get(get);
您還可以傳遞多個獲?。?/p>
Get get1 = new Get(row);
get1.setConsistency(Consistency.TIMELINE);
...
ArrayList<Get> gets = new ArrayList<Get>();
gets.add(get1);
...
Result[] results = table.get(gets);
以及掃描:
Scan scan = new Scan();
scan.setConsistency(Consistency.TIMELINE);
...
ResultScanner scanner = table.getScanner(scan);
您可以通過調(diào)用Result.isStale()方法來檢查結(jié)果是否來自主區(qū)域:
Result result = table.get(get);
if (result.isStale()) {
...
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: