Implementing remote Access HBase, you can easily debug your code with Eclipse development tools.
In order to facilitate the management of various versions of JAR packages, the code is built with Maven
First, download and install maven and the M2eclipse plugin
Next, configure MAVEN's Pom.xml file to include the following dependencies
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>1.0.0-cdh5.4.0</version>
</dependency>
and resource Acquisition configuration information
<repositories>
<repository>
<id>cloudera-releases</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
For a version of Java, you can use the following settings (this article uses more than 1.8 versions)
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Next, build the Eclipse project with maven (Maven Eclipse:eclipse)
The following issues were identified in the deployment:
1. No FileSystem for Scheme:hdfs
Online from common practices:
I added the following to my core-site.xml and it worked:
<Property> <Name>Fs.File.Impl</Name> <Value>Org.Apache.Hadoop.Fs.LocalFileSystem</Value> <Description>The FileSystem ForFile:URIs. </Description></Property><Property> <Name>Fs.Hdfs.Impl</Name> <value>org. Apache. Hadoop. Hdfs. Distributedfilesystem</value> Span class= "pun" ><description>the filesystem for Hdfs:< Span class= "PLN" > Uris.</description> </property>
But after using it, we found that Org.apache.hadoop.hdfs reflection could not find the related class, so in Maven
Add the following dependencies:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.6.0-cdh5.4.0</version>
</dependency>
2. Found that the Hbase-site.xml file has not been read, the following steps need to be taken:
Add Hbase-site.xml to eclipse, add a method, create a folder in Eclipse, peer with SRC, and then copy the Hbase-site.xml to Conf
Right-click the project, build path-----configuter Build path-------liberary----Add Class Forder, select Conf.
3. Add the domain name of each regionserver used in the hosts of the machine used by eclipse
Deploying HBase Remote Access Problem collection (Eclipse)