1.What is Lease
in general,between the communication of client and Region Server,there are RPCs in there.Lease is a mechanism to hold a reference object updated each client rpc. so Lease is similar to Hearbeat for server to know that client is alive always!(of course that is in a certain period in fact)
2.Why use Lease
at a first communication ,e.g. a scan operation,the client will get by batch to limit to size returned,then the client issue the second request to retrieve later data.during these requests,region Server will know to these are a scan operaction in fact,so it is needless to renew or create some new objects/caches/handles to locate the nexxt batch data.that is using a Lease will decrease some resourcces overhead!
so all theese cases will provide more stable,avilable.
u will say:why not use hearbeat instead of it?yes this is a good question.but if take a look carefully,the advantages are distingguished :
-Lease has NOT additional connection overhead,but Hearbeat does.in server,there are resouces created once per 'session',and ONLY 'update-on-requesting'
-easy to implement.the server can use some mechanism like lockid to archive Lease.and the client will only keep a lockid in mind for each request.also,the server will have a timeout strategy to cancel this Lease if over a time range that client has not requested something.
and if some exceptions occurs in server,the client will get them and use some utility methods(eg. scan#close() or htable#unlock() to release the lease immediately)
3.How to use Lease
as mentioned above ,there are two clients interacted with Lease:user client and server-side listener.
that is a 'double check ' for the lease in fact!
4.Compare:Mutation VS Get VS Scan
OP | use lease | through by | time to get | time to release | feature |
Mutation | yes | row lock id |
client:lockRow() server:internalObtainRowLock() if client not locked row before |
client: htable#unlock server: RowLockListener#leaseExpired |
client: manually to generate or remove lease server: automatically to generate or remove if timeout |
Scan | yes | scannerId |
client:openScanner (transparent to client) |
client: scanner#close server: ScannerListener#leaseExpired |
same as above |
Gets | no | ||||
Questions:
while lock id is unique BUT scanner id ?this will causes some odd issues when multi clients use same scanner id.
lock id generateion:(unique)
while (true) { Integer lockId = lockIdGenerator.incrementAndGet(); HashedBytes existingRowKey = lockIds.putIfAbsent(lockId, rowKey); if (existingRowKey == null) { return lockId; } else { // lockId already in use, jump generator to a new spot lockIdGenerator.set(rand.nextInt()); } }
scanner id :
protected long addScanner(RegionScanner s) throws LeaseStillHeldException { long scannerId = -1L; scannerId = rand.nextLong(); String scannerName = String.valueOf(scannerId); scanners.put(scannerName, s); //直接put不考虑存在问题? TBD this.leases.createLease(scannerName, new ScannerListener(scannerName)); return scannerId; }
any clues for me is appreciated!
Note
* invoke a scanner's close method will only remove the lease on region server,but NOT for connection to it.instead of Htable's close method does close all connections established to all servers!
Ref:
相关推荐
2. **工作负载多样性**:YCSB提供了多种预定义的工作负载模型,如读多写少、写多读少、读写均衡等,用于模拟不同的业务场景。通过调整这些工作负载参数,可以对HBase的读写性能、并发处理能力进行深度评估。 3. **...
HBase(hbase-2.4.9-bin.tar.gz)是一个分布式的、面向列的开源数据库,该技术来源于 Fay Chang 所撰写的Google论文“Bigtable:一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统(File System...
`hbase-1.2.0-cdh5.14.2.tar.gz` 是针对Cloudera Distribution Including Apache Hadoop (CDH) 5.14.2的一个特定版本的HBase打包文件。CDH是一个流行的Hadoop发行版,包含了多个大数据组件,如HDFS、MapReduce、YARN...
本文将深入探讨这两个技术及其结合体`phoenix-hbase-2.2-5.1.2-bin.tar.gz`的详细内容。 首先,HBase(Hadoop Database)是Apache软件基金会的一个开源项目,它构建于Hadoop之上,是一款面向列的分布式数据库。...
HBase 元数据修复工具包。 ①修改 jar 包中的application.properties,重点是 zookeeper.address、zookeeper.nodeParent、hdfs....③开始修复 `java -jar -Drepair.tableName=表名 hbase-meta-repair-hbase-2.0.2.jar`
《Phoenix与HBase的深度解析:基于phoenix-hbase-2.4-5.1.2版本》 在大数据处理领域,Apache HBase和Phoenix是两个至关重要的组件。HBase作为一个分布式、列式存储的NoSQL数据库,为海量数据提供了高效、实时的访问...
phoenix-client-hbase-2.2-5.1.2.jar
标题“hbase-1.2.1-bin.tar.gz.zip”表明这是HBase 1.2.1版本的二进制发行版,以tar.gz格式压缩,并且进一步用zip压缩。这种双重压缩方式可能用于减小文件大小,方便在网络上传输。用户需要先对zip文件进行解压,...
赠送jar包:hbase-prefix-tree-1.4.3.jar; 赠送原API文档:hbase-prefix-tree-1.4.3-javadoc.jar; 赠送源代码:hbase-prefix-tree-1.4.3-sources.jar; 赠送Maven依赖信息文件:hbase-prefix-tree-1.4.3.pom; ...
这个“hbase-2.4.17-bin”安装包提供了HBase的最新稳定版本2.4.17,适用于大数据处理和分析场景。下面将详细介绍HBase的核心概念、安装步骤以及配置和管理。 一、HBase核心概念 1. 表(Table):HBase中的表是由行...
hbase-client-2.1.0-cdh6.3.0.jar
被编译的hive-hbase-handler-1.2.1.jar,用于在Hive中创建关联HBase表的jar,解决创建Hive关联HBase时报FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. org.apache.hadoop....
HBCK是HBase1.x中的命令,到了HBase2.x中,HBCK命令不适用,且它的写功能(-fix)已删除;...其GitHub地址为:https://github.com/apache/hbase-operator-tools.git 附件资源是已经编译好的hbase2.4.4版本的hbck
赠送jar包:phoenix-core-4.7.0-HBase-1.1.jar; 赠送原API文档:phoenix-core-4.7.0-HBase-1.1-javadoc.jar; 赠送源代码:phoenix-core-4.7.0-HBase-1.1-sources.jar; 赠送Maven依赖信息文件:phoenix-core-4.7.0...
hbase-hbck2-1.1.0-SNAPSHOT.jar
《Phoenix与HBase的深度解析:基于phoenix-hbase-1.4-4.16.1-bin的探讨》 Phoenix是一种开源的SQL层,它为Apache HBase提供了高性能的关系型数据库查询能力。在大数据领域,HBase因其分布式、列式存储的特性,常被...
赠送jar包:hbase-hadoop-compat-1.1.3.jar; 赠送原API文档:hbase-hadoop-compat-1.1.3-javadoc.jar; 赠送源代码:hbase-hadoop-compat-1.1.3-sources.jar; 赠送Maven依赖信息文件:hbase-hadoop-compat-1.1.3....
赠送jar包:hbase-prefix-tree-1.1.3.jar; 赠送原API文档:hbase-prefix-tree-1.1.3-javadoc.jar; 赠送源代码:hbase-prefix-tree-1.1.3-sources.jar; 赠送Maven依赖信息文件:hbase-prefix-tree-1.1.3.pom; ...
2. **解压安装**:下载的“hbase-2.4.11”压缩包需解压到指定目录,然后配置环境变量,包括HBASE_HOME、PATH等。 3. **配置文件**:修改conf/hbase-site.xml配置文件,设置HBase的主节点(master)地址、Zookeeper...
phoenix-4.14.1-HBase-1.2-client.jar