Hi all, The below code will explain to connect hbase server using hbase api. you have to add library both hadoop-0.19.0 and hbase-0.19.3 in you classpath.
I have created small sample UI application using HBase. I have given source also you can refer it. For more details access URL: http://intellipowerhive.com/products.php /** * @author Arockia Doss S * @email [email protected] * @url http://www.intellipowerhive.com,http://www.dossinfotech.com * @comments You can use and modify this page for your usage. */ package com.iph.hbase.conf; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; public class IPHConfiguration implements java.io.Serializable { //IP and Home Directory has to be modified according to your environment private static final String hbaseMasterValue = "172.21.1.53"; private static final String hbaseHomeDirectory = "/home/hbase-0.19.3/"; //It is not modified code. private static final int hbaseMasterPort = 60000; private static final String hbaseMasterName = "hbase.master"; private static final String hbaseSite = hbaseHomeDirectory+"conf/hbase-site.xml"; private static final String hbaseDefault = hbaseHomeDirectory+"conf/hbase-default.xml"; public static HBaseConfiguration getConf() { HBaseConfiguration conf = new HBaseConfiguration(); conf.set(hbaseMasterName, hbaseMasterValue + ":" + hbaseMasterPort); Path hbaseSitePath = new Path(hbaseSite); Path hbaseDefaultPath = new Path(hbaseDefault); conf.addResource(hbaseSitePath); conf.addResource(hbaseDefaultPath); return conf; } } -- View this message in context: http://www.nabble.com/java-api-error%3A-connection-to-HMaster-tp25976824p25986326.html Sent from the HBase User mailing list archive at Nabble.com.
