1.准备工作
(1) 启动zookeeper服务,我的是在本地启动zookeeper
/usr/local/zookeeper/bin$ sudo zkServer.sh start
(2) 启动HBase和HBase shell
启动HBase:
/usr/local/hbase/bin下启动start-hbase.sh
启动HBase shell
/usr/local/hbase/bin下终端输入hbase shell
(3) 工程的maven依赖
<dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>2.7.3</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> </dependency> <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> <version>1.2.11</version> </dependency>View Code
2.使用javaAPI对HBase进行操作
github链接:https://github.com/gulu2016/STBigData/tree/master/src/main/java/cn/gulu/bigdata/hbase