Hbase1.0 客户端api---神算子
来源:互联网 发布:巨人网络 纪学锋 编辑:程序博客网 时间:2024/05/01 02:04
最近在试用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说明翻译下:
ConnectionFactory
class. The lifecycle of the connection is managed by the caller, who has to close()
the connection 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(),释放资源。关于 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()
on the returned connection instance.Connection
also returns Admin
and RegionLocator
implementations- Hbase1.0 客户端api---神算子
- Hbase1.0 客户端api
- Hbase1.0 客户端api
- HBase1.0+ java-api 介绍
- HBase1.0以上版本的API改变
- Unit3--problem2神算子—造价师
- 内存分配与回收策略---神算子
- python调用linux命令---神算子
- 诸葛亮神算 v5.0 是什么
- shell脚本---源自网站“神算子”:www.wangsenfeng.com
- shell介绍--源自网站“神算子”:www.wangsenfeng.com
- shell小节--源自网站“神算子”:www.wangsenfeng.com
- swap--源自网站“神算子”:www.wangsenfeng.com
- vi 显示行号-----源自网站“神算子”:www.wangsenfeng.com
- Hadoop2.6.0自动化部署脚本(一)---神算子
- hbase1.0 已经发布
- hbase1.0新特性
- hbase1.0集成phoenix
- Java面试题Tomcat的优化经验
- Ubuntu下OpenGrok安装使用
- TableLayout
- HDU 1269
- C# MSCHART 曲线指示数据点
- Hbase1.0 客户端api---神算子
- jQuery源码分析之parents,parentsUntil,next,prev,nextAll,prevAll,nextUntil,prevUntil,siblings,children
- [Hadoop]Hadoop异常汇总,不定期更新
- 关于在VMware虚拟机上调整linux窗口的大小
- filter过滤器的写法
- HDU_4883
- linux命令移动mv -1.log文件
- 已知圆心,半径,角度,求圆上的点坐标
- Word Pattern 双重映射