Hi all,
I'm trying create a table from java client code(windows 7) by connecting in
to hbase which is in Linux VM(oracle linux)
Version : HAdoop:2.2.0
HBASE:0.96.1.1-hadoop2
>From windows system I'm able to browse "
http://192.168.1.42:60010/master-status"; and able login to hbase console
issue the commands(like list, status)
Here is the POM.xml
<dependency>
 <groupId>org.apache.hbase</groupId>
 <artifactId>hbase-client</artifactId>
 <version>0.96.1.1-hadoop2</version>
</dependency>
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;

import com.google.protobuf.ServiceException;
public class HBaseExample {

    public static void main(String args[]) throws IOException,
ServiceException {

    try
    {
     Configuration config = HBaseConfiguration.create();
     config.set("hbase.master", "192.168.1.42:60010");
config.set("hbase.zookeeper.quorum", "192.168.1.42");
config.set("hbase.zookeeper.property.clientPort","2181");
     System.out.println("before HBase is running!");
     HBaseAdmin.checkHBaseAvailable(config);
        HTable table = new HTable(config, "testtable");

        System.out.println("HBase is running!");
    }
    catch (MasterNotRunningException e) {
    System.out.println("Could not setup HBaseAdmin as no master is running,
did you start HBase?...");
    }
    catch (ZooKeeperConnectionException e) {
    System.out.println("Could not connect to ZooKeeper");
    } catch (IOException e) {
    System.out.println("Caught IOException: " + e.getMessage());
    }
    }
}
An exception  "MasterNotRunningException " is caught.
I'm able to browse "http://192.168.1.42:60030/rs-status"- regional server
also
http://192.168.1.42:60010/master-status- Master node.

Any comments or suggestion or  comments will be of great help

Reply via email to