Hbase1.0 客户端api
最近在试用Hbase1.0的客户端API,发觉变化还是挺大(以前版本也不熟)。到处都是deprecated。
现在应该是这样子:
Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "quorum1,quorum2,quorum3");
conf.set("hbase.zookeeper.property.clientPort", "2181");
connection = ConnectionFactory.createConnection(conf);// HBase 0.99+
//connection = HConnectionManager.createConnection(conf); // HBase <0.99
Table table = connection.getTable(TableName.valueOf("TestTable"));
新的客户端API中,Connection处于关键位置,以下api说明翻译下:
encapsulating lower level individual connections to actual servers and a
connection to zookeeper. Connections are instantiated through the
ConnectionFactory class.The lifecycle of the connection is managed by the caller, who has to
close() theconnection to release the resources.
The connection object contains logic to find the master, locate
regions out on the cluster, keeps a cache of locations and then knows
how to re-calibrate after they move. The individual connections to
servers, meta cache, zookeeper connection, etc are all
shared by the Table and Admin instances
obtained from this connection.
Connection creation is a heavy-weight operation. Connection
implementations are thread-safe, so that the client can create a
connection once, and share it with different threads. Table and Admin instances,
on the other hand, are light-weight and are not thread-safe. Typically,
a single connection per client application is instantiated and every
thread will obtain its own Table instance. Caching or pooling of Table and Admin is
not recommended.
This class replaces HConnection,
which is now deprecated.
ConnectionFactory类实例化。Connection的生命周期由调用者维护,调用者通过调用close(),释放资源。操作。
Connection是线程安全的,因此,多个客户端线程可以共享一个Connection。Table和Admin实例,相反地,是轻量级的并且非线程
安全。典型的用法,一个客户端程序共享一个单独的Connection,每一个线程获取自己的Table实例。不建议缓存或者池化
(pooling)Table、Admin。
关于 ConnectionFactory.createConnection函数的说明:
public static Connection createConnection(org.apache.hadoop.conf.Configuration conf)
conf instance. Connection encapsulates all housekeeping for a connection to the cluster. All tables and interfaces created from returned connection share zookeeper connection, meta cache, and connections to region servers and masters. The caller is responsible for calling
Connection.close() onthe returned connection instance.
Hbase1.0 客户端api的更多相关文章
- HBase1.0以上版本的API改变
HBase1.0以上版本已经废弃了 HTableInterface,HTable,HBaseAdmin等API的使用,新增了一些API来实现之前的功能: Connectioninterface: Co ...
- HBase1.0以上版本号的API改变
HBase1.0以上版本号已经废弃了 HTableInterface,HTable,HBaseAdmin等API的使用.新增了一些API来实现之前的功能: Connectioninterface: C ...
- SignalR的Javascript客户端API使用方式整理
SignalR的服务端提供了两种实现方式,分别是PersistentConnection和Hub,这两种方式的侧重点不同: PersistentConnection更接近于底层,编程接口比较简单,传输 ...
- JAVA客户端API调用memcached两种方式
1. memcached client for java客户端API:memcached client for java 引入jar包:java-memcached-2.6.2.jar package ...
- Redis C客户端API - God's blog - 博客频道 - CSDN.NET
Redis C客户端API - God's blog - 博客频道 - CSDN.NET Redis安装步骤: 1.redis server安装 wget http://redis.googlecod ...
- 通过 Jersey Http请求头,Http响应头,客户端 API 调用 REST 风格的 Web 服务
原地址:http://blog.csdn.net/li575098618/article/details/47853263 Jersey 1.0 是一个开源的.可以用于生产环境的 JAX-RS(RES ...
- Jersey客户端API调用REST风格的Web服务
Jersey 客户端 API 基础 jersey-1.14.jar 密码: cxug 要开始使用 Jersey 客户端 API,你首先需要创建一个 com.sun.jersey .api.client ...
- RabbitMQ系列教程之七:RabbitMQ的 C# 客户端 API 的简介
今天这篇博文是我翻译的RabbitMQ的最后一篇文章了,介绍一下RabbitMQ的C#开发的接口.好了,言归正传吧. Net/C# 客户端 API简介1.主要的命名空间,接口和类 定义核心的API的 ...
- 从头编写 asp.net core 2.0 web api 基础框架 (1)
工具: 1.Visual Studio 2017 V15.3.5+ 2.Postman (Chrome的App) 3.Chrome (最好是) 关于.net core或者.net core 2.0的相 ...
随机推荐
- jquery判断当前设备是手机还是电脑并跳转
<script type="text/javascript"> var commonURL = 'http://xxxx.com/'; function mobile_ ...
- TortoiseSVN常用操作说明
TortoiseSVN是windows下其中一个非常优秀的SVN客户端工具.通过使用它,我们可以可视化的管理我们的版本库.不过由于它只是一个客户端,所以它不能对版本库进行权限管理. TortoiseS ...
- javascript、正则的验证
js验证.手机.固话.邮箱.身份证.网址.日期等 Verification.js文件 /* * 手机号码格式 * 只允许以13.15.18开头的号码 * 如:13012345678.159292243 ...
- windows7下安装php的imagick和imagemagick扩展教程
这篇文章主要介绍了windows7下安装php的imagick和imagemagick扩展教程,同样也适应XP操作系统,Win8下就没测试过了,需要的朋友可以参考下 最近的PHP项目中,需要用到切图和 ...
- 为什么接口类型可以直接new?
Runnable rn = new Runnable() { public void run() { } }; 实际相当于,jdk会自动生成一个匿名内部类,完成职责: class Anomymous ...
- Codeforces Round #103 (Div. 2) D. Missile Silos(spfa + 枚举边)
题目链接:http://codeforces.com/problemset/problem/144/D 思路:首先spfa求出中心点S到其余每个顶点的距离,统计各顶点到中心点的距离为L的点,然后就是要 ...
- HeapSort自己yy-未完成
#include <iostream> #include <cstdio> using namespace std; ; int a[maxn]; int HeapSize; ...
- jq获取后台json并解析
参考: $(function () { $.ajax({ url: 'tsconfig.json', type: 'GET', dataType: 'json', timeout: 1000, cac ...
- DotNet 资源大全中文版,内容包括:编译器、压缩、应用框架、应用模板、加密、数据库、反编译、IDE、日志、风格指南等
DotNet 资源大全中文版 我想很多程序员应该记得 GitHub 上有一个 Awesome - XXX 系列的资源整理.awesome-dotnet 是由 quozd 发起和维护.内容包括:编译器. ...
- Android自动化压力测试之Monkey Test 异常解读(五)
monkey结果分类 monkey结果详细解读 monkey运行log输出后,得读懂日志内容,定位错误 lgo日志顺序输出分别为 测试命令信息.随机事件流(11种事件).异常信息(anr.crash ...