You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by jeevi tesh <je...@gmail.com> on 2014/02/03 14:01:57 UTC
help needed in connection hbase
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
Re: help needed in connection hbase
Posted by Ted Yu <yu...@gmail.com>.
bq. config.set("hbase.master", "192.168.1.42:60010");
The above is not needed.
Can you show the full stack trace for MasterNotRunningException ?
There is another thread with same subject where some people replied to you.
It would be better to continue discussion under that thread.
Cheers
On Mon, Feb 3, 2014 at 5:01 AM, jeevi tesh <je...@gmail.com> wrote:
> 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
>