In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how Windows Java code remotely accesses HBase. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
To build a maven project, pom depends on the following:
Org.apache.hbase
Hbase-client
1.2.0-cdh6.7.0
Org.apache.hadoop
Hadoop-hdfs
2.6.0-cdh6.7.0
Since the cdh version I use, the default source contains only common dependencies, so you need to add the following sources provided by Cloudera:
Cloudera
Https://repository.cloudera.com/artifactory/cloudera-repos/
Note: if Ali image is configured in the Maven configuration file setting.xml, the CDH-related jar package cannot be downloaded. You can use the default image of maven.
Establish a connection
The pseudo code is as follows:
Public class HbaseBaseClient {
Private static Configuration confHbase = null
Private static Connection connection = null
{
ConfHbase = HBaseConfiguration.create ()
ConfHbase.setLong ("hbase.rpc.timeout", 600000)
ConfHbase.setLong ("hbase.client.scanner.caching", 1000)
ConfHbase.set ("hbase.zookeeper.quorum", zknode)
ConfHbase.set ("hbase.zookeeper.property.clientPort", "2181")
/ / No FileSystem for schema: hdfs
ConfHbase.set ("fs.hdfs.impl", "org.apache.hadoop.hdfs.DistributedFileSystem")
Try {
Connection=ConnectionFactory.createConnection (confHbase);} catch (IOException e) {e.printStackTrace ();}
Just configure the zk address, and you can access it through Master.
The most important step:
Configure the hosts file!
All hosts should be configured!
Otherwise, it will make the following error:
Java.net.UnknownHostException: unknown host
In this way, you can write the add, delete, modify and check code, and then right-click to execute the run command!
Of course, you must be able to ping the server! Some intranets are inaccessible! There are other ways to debug! We'll talk about it later!
About Windows Java code how to remotely access HBase to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.