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的相 ...
随机推荐
- 攻城狮在路上(壹) Hibernate(十六)--- Hibernate声明数据库事务
一.数据库事务的概念: 数据库的ACID特征:Atomic.Consistency.Isolation.Durability.原子性.一致性.隔离性.持久性.不同的隔离级别引发的不同问题. 事务的AC ...
- centos(x86 64位系统)使用boost
1. 安装gcc,g++,make等开发环境 yum groupinstall "Development Tools" 2. 安装boost yum install boost b ...
- 配置ogg异构oracle-mysql(1)基础环境配置
一.环境描述: 192.168.0.164 ( Oracle ) —> 192.168.0.165 (Mysql ) 版本: 操作系统:redhat5.8 Oracle: 11.2.0.3 M ...
- 第七篇:创建一个SOUI的Hello World
从0开始一个SOUI项目 1.环境配置 SOUI项目本质是一个基于Win32窗口的应用程序.因此首先我们可以从Win32窗口应用程序向导创建一个简单的Win32项目. 并在第3页选择“Window应用 ...
- BuildFilePath 及打开文件对话框
也许以后就主要在这里发SOUI的介绍了. 贴一段文件相关的helper, 测试一下贴代码是不是方便. /** * Copyright (C) 2014-2050 * All rights reserv ...
- C语言中运算符的口决
- lr中switch的应用
Action() { char *time; int i,j,length; time=lr_eval_string("{testtime}"); lr_error_message ...
- DSP using MATLAB示例Example3.6
代码: n = [-5:5]; x = (-0.9).^n; % x(n) = k = -200:200; w = (pi/100)*k; % [0,pi] axis divided into 101 ...
- nodejs随记03
文件操作 文件系统的操作 fs.readFile(filename, [options], callback) fs.writeFile(filename, data, [options], call ...
- mac OS X操作 -- 常用
显示/隐藏默认隐藏文件:defaults write com.apple.finder AppleShowAllFiles -bool true/false 重置ROOT密码: http://www. ...