"Gandalf" Eclipse+maven build hbase development environment and Hbasedao code example

Source: Internet
Author: User

Environment:Win764biteclipse version:kepler Service Release 1java Version "1.7.0_40" First step:Create a new MAVEN project in Eclipse, edit the Pom.xml and update the download jar package <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/ Maven-4.0.0.xsd "> <modelversion>4.0.0</modelversion> <groupId>fulong.bigdata</groupId> <artifactid>myhbase</artifactid> <version>0.0.1-snapshot</version> <dependencies> <dependency> <groupId>org.apache.hbase</groupId> <artifactid> hbase-client</artifactid> <version>0.96.2-hadoop2</version> </dependency> <dependency> <groupId>org.apache.hadoop</groupId> <artifactid> hadoop-hdfs</artifactid> <version>2.2.0</version> </dependency> <dependency> <groupId>jdk.tools</groupId> <artifactid>jdk.tools</artifactid> <version>1.7</version> <scope>system</scope> <systempath>${java_home}/lib/tools.jar</systempath> </dependency> </dependencies> </Project> 

Step Two:The target cluster's Hadoop and HBase configuration files are copied to the projectThe goal is to enable the project to find zookeeper and HBase Master. The path to the configuration file in the project is:/src/main/resources/hadoop
/src/main/resources/hbase

The two directories are then added to the classpath of the project:

The final directory structure is as follows:


Step Three: Add in Hbase-site.xml
<property > <name>fs.hdfs.impl</name> <value> org.apache.hadoop.hdfs.DistributedFileSystem</value> </property > Fourth Step: Write Java program invoke HBase interfaceThis code contains some of the commonly used hbase interfaces.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.