spring data hadoop操作hbase

本文介绍了如何利用spring-data-hadoop与Hbase进行集成,涉及的jar版本包括hbase-client、spring-data-hadoop和Spring。核心操作类为HbaseTemplate,它实现了Hbase的配置和初始化。配置文件包括hbase-site.xml和applicationContext,HbaseTemplate继承HbaseAccessor和实现了HbaseOperations接口,提供了对Hbase的操作。此外,文章还解析了与Hbase交互的关键类HtableInterface。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、使用的jar版本

1、hbase-client:0.96.1.1-cdh5.0.0

2、spring-data-hadoop:2.2.1.RELEASE

3、Spring:4.2.1.RELEASE

二、hbase-site.xml配置

<configuration>

 <property>

  <name>hbase.zookeeper.quorum</name>

  <value>chhliu1,chhliu2,chhliu3</value>

  </property>

  <property>

  <name>hbase.zookeeper.property.clientPort</name>

  <value>2181</value>

  </property>

</configuration>
注:由于 hbase 依赖了 zookeeper ,所以需要指定 zookeeper 集群的地址以及端口号,此处需在 hosts 文件中加入 chhliu1 chhliu2 chhliu3 对应的 IP 地址。

三、applicationContext配置文件

<?xml version="1.0" encoding="UTF-8"?>  

    <beans xmlns="http://www.springframework.org/schema/beans"  

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  

   xmlns:context="http://www.springframework.org/schema/context"

   xmlns:p="http://www.springframework.org/schema/p"

   xmlns:hdp="http://www.springframework.org/schema/hadoop"  

   xmlns:beans="http://www.springframework.org/schema/beans"  

   xsi:schemaLocation="  

   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd 

    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd  

    http://www.springframework.org/schema/hadoop http://www.springfr
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值