I have a standlone HBase server. This is my hbase-site.xml:
<configuration> <property> <name>hbase.rootdir</name> <value>file:///hbase_data</value> </property> </configuration>
I am trying to write a Java program to manipulate the data in the HBase.
If I run the program on the HBase server, it works fine. But I don't know how to config it for remote access.
Configuration config = HBaseConfiguration.create(); HTable table = new HTable(config, "test"); Scan s = new Scan();
I have tried adding IP and Port, it doesn't work:
config.set("hbase.master", "146.169.35.28:60000")
Can anyone tell me how to do it?
Thanks!
Advertisements. This chapter describes the java client API for HBase that is used to perform CRUD operations on HBase tables. HBase is written in Java and has a Java Native API. Therefore it provides programmatic access to Data Manipulation Language (DML).
Here's a snippet from a system we use to create an HTable we use to connect to HBase
Configuration hConf = HBaseConfiguration.create(conf); hConf.set(Constants.HBASE_CONFIGURATION_ZOOKEEPER_QUORUM, hbaseZookeeperQuorum); hConf.setInt(Constants.HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT, hbaseZookeeperClientPort); HTable hTable = new HTable(hConf, tableName);
HTH
EDIT: Example Values:
public static final String HBASE_CONFIGURATION_ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum"; public static final String HBASE_CONFIGURATION_ZOOKEEPER_CLIENTPORT = "hbase.zookeeper.property.clientPort"; ... hbaseZookeeperQuorum="PDHadoop1.corp.CompanyName.com,PDHadoop2.corp.CompanyName.com"; hbaseZookeeperClientPort=10000; tableName="HBaseTableName";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With