HBase client总览


HBase Client总览

1. affects concurrent readers and writers of that same row ==> atomic on a per-row basis


2. RWCC : ReadWriteConsistencyControl

read without wait for writes

write wait for other writes


3. CRUD

Put (single/batch)  :

rowlock, writeToWAL, timeStamp, client-side write buffer, atomic compare-and-set

Get(single/batch) :

rowlock, timeRage, filter, cacheBlocks

Scan:

Caching , Batching 


4. Schema

Tables attributed Classes --> Hadoop Writalbe

Talbe Properities: name, column families, maximum file size, read-only, memstore flush size, deferred log flush 

Column families: name, maximum versions, compression, block size, block cache, time-to-live, in-memory, bloom filter, replication scope


HBase Client源码 

1. HConnection : HConnectionManager.HConnectionImplement

use by HTableInterface,  HMasterInterface, RootRegionTracker, MasterrAddressTrakder, ZookeeperWatcher 

pause, numberTrtries, maxRPCAttempts, rpcTimeout, configuration

cacheRegionLocations, cachedServer


2. HTableInterface : HTable

connection, tableName, configuration

operationTimeout, cleanPoolOnClose, cleanConnectionOnClose

writerBuffer, writeBufferSize, currentWriteBufferSize, DOPUT_WB_CHECK, scannerCaching, maxKeyValueSize


3. HConnectionManager

Map<HConnectionKey, HConnectionImplement> HBASE_INSTANSE;


4. HConnectionKey

properties :  map

userrname: String


5. ClientScanner


6. ScannerCallable extends ServerCallable


7. ServerCallable extends VersionedProtocol

connection, table, row, hRegionLocation

HRegionInterface server;  // java动态代理机制 入口

Result[] call()

       openScanner

       server.next(scannerid, caching)


8. Result

KeyValue [] kvs
NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> familyMap
 byte [] row
ImmutableBytesWritable bytes



RPC机制

1. 通信

rpc角色: client/server

通信信道:socket

接口/协议: 对象序列化

控制: 传输,并发, 会话

保障: 出错重试


2. 工作流程

客户端获取通信接口实例

客户端通过调用实例方法, 向服务端传输请求

服务端被调用, 进行处理并返回结果


3. 序列化

Hbase: org.apache.hadoop.hbase.io.HbaseObjectWritable

1) 类code映射表->CLASS_TO_CODE

2)类实例code映射表->CODE_TO_CLASS : 要传输的类(实现Writable), 原始类型, 其他(String, 数组)


Hadoop: org.apache.hadoop.io.WriteAble

1) write(DataOutput out)

2) readFile(DataInput in)


你可能感兴趣的:(HBase client总览)