hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeevi tesh <jeevitesh...@gmail.com>
Subject help needed towards connecting Hbase
Date Fri, 31 Jan 2014 07:51:38 GMT
Hi all,

I'm writing simple java program to connect to HBase.

Versions of software used

Hbase 0.96.0-hadoop2

Hadoop:hadoop-2.2.0.

I'm trying to connect from my windows 7 (32 bit)machine to oracle linux
machine (Details :VM, 64 bit).Note I have not installed ZooKeeper.


Any suggestion or comments will be of great help

Thanks

Here is the script...

*package* pack1;



*import* java.io.IOException;



*import* org.apache.hadoop.conf.Configuration;

*import* org.apache.hadoop.hbase.HBaseConfiguration;

*import* org.apache.hadoop.hbase.client.HTable;

*import* org.apache.hadoop.hbase.client.Put;

*import* org.apache.hadoop.hbase.util.Bytes;



*public* *class* testDB {



      /**

       * *@param* args

       */

      *public* *static* *void* main(String[] args) {

            *try* {

            System.*out*.println("1 Before HBASE COnfiguration");

            Configuration config = HBaseConfiguration.*create*();

            config.clear();

            System.*out*.println("2 Before HBASE COnfiguration");

            config.set("hbase.master", "192.168.1.42:60010");



            System.*out*.println("HBase is running!");

            HTable table;



                        table = *new* HTable(config, "mytable");



            System.*out*.println("Table mytable obtained ");



            Put put = *new* Put(Bytes.*toBytes*("row1"));

            put.add(Bytes.*toBytes*("colfam1"),Bytes.*toBytes*("qual1"
),Bytes.*toBytes*("val1"));

            put.add(Bytes.*toBytes*("colfam1"),Bytes.*toBytes*("qual2"
),Bytes.*toBytes*("val2"));

            table.put(put);

            } *catch* (IOException e) {



                        e.printStackTrace();

            }



      }



}

Error message

1 Before HBASE COnfiguration

2 Before HBASE COnfiguration

HBase is running!

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client environment:host.name
=DELL-75.unilog

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.version=1.6.0_16

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.vendor=Sun Microsystems Inc.

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.home=C:\Program Files\Java\jdk1.6.0_16\jre

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.class.path=E:\jeevi\XRFWorkSpace200\testdbcon\bin;E:\jeevi\XRF100\WebContent\WEB-INF\lib\apache-logging-log4j.jar;E:\jeevi\XRF100\WebContent\WEB-INF\lib\asm-3.1.jar;E:\jeevi\XRF100\WebContent\WEB-INF\lib\commons-logging-1.1.3.jar;E:\jeevi\XRF100\WebContent\WEB-INF\lib\hadoop-core-0.19.0.jar;E:\jeevi\XRF100\WebContent\WEB-INF\lib\hbase-0.90.2.jar;E:\jeevi\XRF100\WebContent\WEB-INF\lib\zookeeper-3.3.2.jar

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.library.path=C:\Program
Files\Java\jdk1.6.0_16\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program
Files\Common Files\Acronis\SnapAPI\;C:\Program
Files\Java\jdk1.6.0_16\bin;C:\apache-maven-3.1.1\bin

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.io.tmpdir=C:\Users\jems\AppData\Local\Temp\

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:java.compiler=<NA>

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client environment:os.name=Windows
7

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client environment:os.arch=x86

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:os.version=6.1

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client environment:user.name
=jems

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:user.home=C:\Users\jems

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Client
environment:user.dir=E:\jeevi\XRFWorkSpace200\testdbcon

14/01/31 13:14:55 INFO zookeeper.ZooKeeper: Initiating client connection,
connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection

14/01/31 13:14:55 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/127.0.0.1:2181

14/01/31 13:14:56 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.ConnectException*: Connection refused: no further information

      at sun.nio.ch.SocketChannelImpl.checkConnect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.finishConnect(
*SocketChannelImpl.java:574*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1119*)

14/01/31 13:14:56 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/0:0:0:0:0:0:0:1:2181

14/01/31 13:14:56 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.SocketException*: Address family not supported by protocol
family: connect

      at sun.nio.ch.Net.connect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.connect(*SocketChannelImpl.java:507*)

      at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(
*ClientCnxn.java:1050*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1077*)

14/01/31 13:14:58 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/127.0.0.1:2181

14/01/31 13:14:59 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.ConnectException*: Connection refused: no further information

      at sun.nio.ch.SocketChannelImpl.checkConnect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.finishConnect(
*SocketChannelImpl.java:574*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1119*)

14/01/31 13:14:59 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/0:0:0:0:0:0:0:1:2181

14/01/31 13:14:59 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.SocketException*: Address family not supported by protocol
family: connect

      at sun.nio.ch.Net.connect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.connect(*SocketChannelImpl.java:507*)

      at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(
*ClientCnxn.java:1050*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1077*)

14/01/31 13:15:00 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/127.0.0.1:2181

14/01/31 13:15:01 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.ConnectException*: Connection refused: no further information

      at sun.nio.ch.SocketChannelImpl.checkConnect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.finishConnect(
*SocketChannelImpl.java:574*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1119*)

14/01/31 13:15:02 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/0:0:0:0:0:0:0:1:2181

14/01/31 13:15:02 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.SocketException*: Address family not supported by protocol
family: connect

      at sun.nio.ch.Net.connect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.connect(*SocketChannelImpl.java:507*)

      at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(
*ClientCnxn.java:1050*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1077*)

14/01/31 13:15:03 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/127.0.0.1:2181

14/01/31 13:15:04 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.ConnectException*: Connection refused: no further information

      at sun.nio.ch.SocketChannelImpl.checkConnect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.finishConnect(
*SocketChannelImpl.java:574*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1119*)

14/01/31 13:15:05 INFO zookeeper.ClientCnxn: Opening socket connection to
server localhost/0:0:0:0:0:0:0:1:2181

14/01/31 13:15:05 WARN zookeeper.ClientCnxn: Session 0x0 for server null,
unexpected error, closing socket connection and attempting reconnect

*java.net.SocketException*: Address family not supported by protocol
family: connect

      at sun.nio.ch.Net.connect(*Native Method*)

      at sun.nio.ch.SocketChannelImpl.connect(*SocketChannelImpl.java:507*)

      at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(
*ClientCnxn.java:1050*)

      at org.apache.zookeeper.ClientCnxn$SendThread.run(
*ClientCnxn.java:1077*)

*org.apache.hadoop.hbase.ZooKeeperConnectionException*:
*org.apache.hadoop.hbase.ZooKeeperConnectionException*:
*org.apache.zookeeper.KeeperException$ConnectionLossException*:
KeeperErrorCode = ConnectionLoss for /hbase

      at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(
*HConnectionManager.java:1000*)

      at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.setupZookeeperTrackers(
*HConnectionManager.java:303*)

      at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.<init>(
*HConnectionManager.java:294*)

      at org.apache.hadoop.hbase.client.HConnectionManager.getConnection(
*HConnectionManager.java:156*)

      at org.apache.hadoop.hbase.client.HTable.<init>(*HTable.java:167*)

      at org.apache.hadoop.hbase.client.HTable.<init>(*HTable.java:145*)

      at pack1.testDB.main(*testDB.java:27*)

Caused by: *org.apache.hadoop.hbase.ZooKeeperConnectionException*:
*org.apache.zookeeper.KeeperException$ConnectionLossException*:
KeeperErrorCode = ConnectionLoss for /hbase

      at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(
*ZooKeeperWatcher.java:147*)

      at
org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getZooKeeperWatcher(
*HConnectionManager.java:998*)

      ... 6 more

Caused by: *org.apache.zookeeper.KeeperException$ConnectionLossException*:
KeeperErrorCode = ConnectionLoss for /hbase

      at org.apache.zookeeper.KeeperException.create(
*KeeperException.java:90*)

      at org.apache.zookeeper.KeeperException.create(
*KeeperException.java:42*)

      at org.apache.zookeeper.ZooKeeper.create(*ZooKeeper.java:637*)

      at org.apache.hadoop.hbase.zookeeper.ZKUtil.createAndFailSilent(
*ZKUtil.java:902*)

      at org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher.<init>(
*ZooKeeperWatcher.java:133*)

      ... 7 more

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message