Hi, I am new to hadoop and hbase. I was able to configure a pseudo-distributed hbase instance using HDFS file system. I can interact to my hbase instance using hbase shell with no problem. But I'm having serious problem trying to connect this hbase instance using plan a java code.
I'm fighting for hours and I can't figure out what I'm doing wrong. pls let me know if you can help. this is the exception that stops me Exception in thread "main" java.lang.IllegalArgumentException: Not a host:port pair: [email protected] ,60000,1327639058703 at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:60) here is the hbase-site.xml <property> <name>hbase.rootdir</name> <value>hdfs://localhost:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> <description>The mode the cluster will be in. Possible values are false: standalone and pseudo-distributed setups with managed Zookeeper true: fully-distributed with unmanaged Zookeeper Quorum (see hbase-env.sh) </description> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> <description>Property from ZooKeeper's config zoo.cfg. The port at which the clients will connect. </description> </property> <property> <name>dfs.replication</name> <value>1</value> <description>The replication count for HLog and HFile storage. Should not be greater than HDFS datanode count. </description> </property> <property> <name>hbase.zookeeper.quorum</name> <value>localhost</value> <description>Comma separated list of servers in the ZooKeeper Quorum. For example, "host1.mydomain.com,host2.mydomain.com,host3.mydomain.com". By default this is set to localhost for local and pseudo-distributed modes of operation. For a fully-distributed setup, this should be set to a full list of ZooKeeper quorum servers. If HBASE_MANAGES_ZK is set in hbase-env.sh this is the list of servers which we will start/stop ZooKeeper on. </description> </property> <property> <name>hbase.zookeeper.property.dataDir</name> <value>/usr/local/hbase/zookeeper/data</value> <description>Property from ZooKeeper's config zoo.cfg. The directory where the snapshot is stored. </description> </property> Here is the java code public static void main(String[] args) throws IOException { // CONFIGURATION Configuration config = HBaseConfiguration.create(); config.set("hbase.zookeeper.quorum", "localhost"); config.set("hbase.zookeeper.property.clientPort", "2181"); // ENSURE RUNNING try { HBaseAdmin.checkHBaseAvailable(config); //I got an exception here } catch (MasterNotRunningException e) { System.out.println("HBase is not running!"); System.exit(1); } System.out.println("HBase is running!"); here is the log of my java class. [DEBUG] hconnection opening connection to ZooKeeper with ensemble (localhost:2181) [INFO] Client environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT [INFO] Client environment:host.name=i01co2410.fe.up.pt [INFO] Client environment:java.version=1.6.0_29 [INFO] Client environment:java.vendor=Apple Inc. [INFO] Client environment:java.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home [INFO] Client environment:java.class.path=/Users/arianpasquali/Dropbox/FEUP/workspace/crawl.twitter/target/classes:/Users/arianpasquali/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/arianpasquali/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar:/Users/arianpasquali/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar:/Users/arianpasquali/.m2/repository/asm/asm/3.1/asm-3.1.jar:/Users/arianpasquali/.m2/repository/org/apache/hadoop/avro/1.3.3/avro-1.3.3.jar:/Users/arianpasquali/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/Users/arianpasquali/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar:/Users/arianpasquali/.m2/repository/commons-el/commons-el/1.0/commons-el-1.0.jar:/Users/arianpasquali/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar:/Users/arianpasquali/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar:/Users/arianpasquali/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar:/Users/arianpasquali/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/arianpasquali/.m2/repository/commons-net/commons-net/1.4.1/commons-net-1.4.1.jar:/Users/arianpasquali/.m2/repository/org/eclipse/jdt/core/3.1.1/core-3.1.1.jar:/Users/arianpasquali/.m2/repository/com/google/guava/guava/r06/guava-r06.jar:/Users/arianpasquali/.m2/repository/org/apache/hadoop/hadoop-core/0.20-append-r1056497/hadoop-core-0.20-append-r1056497.jar:/Users/arianpasquali/.m2/repository/org/apache/hbase/hbase/0.90.5/hbase-0.90.5.jar:/Users/arianpasquali/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.5.5/jackson-core-asl-1.5.5.jar:/Users/arianpasquali/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.5.5/jackson-jaxrs-1.5.5.jar:/Users/arianpasquali/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.4.2/jackson-mapper-asl-1.4.2.jar:/Users/arianpasquali/.m2/repository/org/codehaus/jackson/jackson-xc/1.5.5/jackson-xc-1.5.5.jar:/Users/arianpasquali/.m2/repository/tomcat/jasper-compiler/5.5.23/jasper-compiler-5.5.23.jar:/Users/arianpasquali/.m2/repository/tomcat/jasper-runtime/5.5.23/jasper-runtime-5.5.23.jar:/Users/arianpasquali/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar:/Users/arianpasquali/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1.jar:/Users/arianpasquali/.m2/repository/com/sun/jersey/jersey-core/1.4/jersey-core-1.4.jar:/Users/arianpasquali/.m2/repository/com/sun/jersey/jersey-json/1.4/jersey-json-1.4.jar:/Users/arianpasquali/.m2/repository/com/sun/jersey/jersey-server/1.4/jersey-server-1.4.jar:/Users/arianpasquali/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar:/Users/arianpasquali/.m2/repository/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26.jar:/Users/arianpasquali/.m2/repository/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26.jar:/Users/arianpasquali/.m2/repository/org/jruby/jruby-complete/1.6.0/jruby-complete-1.6.0.jar:/Users/arianpasquali/.m2/repository/org/mortbay/jetty/jsp-2.1/6.1.14/jsp-2.1-6.1.14.jar:/Users/arianpasquali/.m2/repository/org/mortbay/jetty/jsp-api-2.1/6.1.14/jsp-api-2.1-6.1.14.jar:/Users/arianpasquali/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/Users/arianpasquali/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/Users/arianpasquali/.m2/repository/com/google/protobuf/protobuf-java/2.3.0/protobuf-java-2.3.0.jar:/Users/arianpasquali/.m2/repository/org/mortbay/jetty/servlet-api-2.5/6.1.14/servlet-api-2.5-6.1.14.jar:/Users/arianpasquali/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar:/Users/arianpasquali/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar:/Users/arianpasquali/.m2/repository/org/apache/solr/solr-solrj/3.5.0/solr-solrj-3.5.0.jar:/Users/arianpasquali/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/Users/arianpasquali/.m2/repository/org/apache/thrift/thrift/0.2.0/thrift-0.2.0.jar:/Users/arianpasquali/.m2/repository/org/twitter4j/twitter4j-async/2.2.6-SNAPSHOT/twitter4j-async-2.2.6-SNAPSHOT.jar:/Users/arianpasquali/.m2/repository/org/twitter4j/twitter4j-core/2.2.6-SNAPSHOT/twitter4j-core-2.2.6-SNAPSHOT.jar:/Users/arianpasquali/.m2/repository/org/twitter4j/twitter4j-stream/2.2.6-SNAPSHOT/twitter4j-stream-2.2.6-SNAPSHOT.jar:/Users/arianpasquali/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.jar:/Users/arianpasquali/.m2/repository/xmlenc/xmlenc/0.52/xmlenc-0.52.jar:/Users/arianpasquali/.m2/repository/org/apache/zookeeper/zookeeper/3.3.2/zookeeper-3.3.2.jar [INFO] Client environment:java.library.path=.:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java [INFO] Client environment:java.io.tmpdir=/var/folders/9O/9OUQnXB5H1iHzEBd9RvwWk+++Tk/-Tmp-/ [INFO] Client environment:java.compiler=<NA> [INFO] Client environment:os.name=Mac OS X [INFO] Client environment:os.arch=x86_64 [INFO] Client environment:os.version=10.6.8 [INFO] Client environment:user.name=arianpasquali [INFO] Client environment:user.home=/Users/arianpasquali [INFO] Client environment:user.dir=/Users/arianpasquali/Dropbox/FEUP/workspace/crawl.twitter [INFO] Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection [DEBUG] zookeeper.disableAutoWatchReset is false [INFO] Opening socket connection to server localhost/127.0.0.1:2181 [INFO] Socket connection established to localhost/127.0.0.1:2181, initiating session [DEBUG] Session establishment request sent on localhost/127.0.0.1:2181 [INFO] Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x1351d745351000e, negotiated timeout = 180000 [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 1,3 replyHeader:: 1,77,0 request:: '/hbase,F response:: s{2,2,1327637412087,1327637412087,0,11,0,0,0,9,41} [DEBUG] hconnection Received ZooKeeper Event, type=None, state=SyncConnected, path=null [DEBUG] hconnection-0x1351d745351000e connected [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 2,3 replyHeader:: 2,77,0 request:: '/hbase/unassigned,F response:: s{3,3,1327637412098,1327637412098,0,6,0,0,0,0,57} [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 3,3 replyHeader:: 3,77,0 request:: '/hbase/rs,F response:: s{4,4,1327637412100,1327637412100,0,1,0,0,0,1,36} [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 4,3 replyHeader:: 4,77,0 request:: '/hbase/table,F response:: s{6,6,1327637412104,1327637412104,0,2,0,0,0,0,52} [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 5,3 replyHeader:: 5,77,0 request:: '/hbase/master,T response:: s{29,29,1327639059403,1327639059403,0,0,0,87008153254821888,68,0,29} [DEBUG] hconnection-0x1351d745351000e Set watcher on existing znode /hbase/master [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 6,4 replyHeader:: 6,77,0 request:: '/hbase/master,T response:: #ffffffff000173436373940693031636f323431302e66652e75702e707400693031636f323431302e66652e75702e70742c36303030302c31333237363339303538373033,s{29,29,1327639059403,1327639059403,0,0,0,87008153254821888,68,0,29} [DEBUG] hconnection-0x1351d745351000e Retrieved 68 byte(s) of data from znode /hbase/master and set watcher; \xFF\x00\x00\x00\x174679@i01c... [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 7,3 replyHeader:: 7,77,0 request:: '/hbase/root-region-server,T response:: s{41,41,1327639068525,1327639068525,0,0,0,0,66,0,41} [DEBUG] hconnection-0x1351d745351000e Set watcher on existing znode /hbase/root-region-server [DEBUG] Reading reply sessionid:0x1351d745351000e, packet:: clientPath:null serverPath:null finished:false header:: 8,4 replyHeader:: 8,77,0 request:: '/hbase/root-region-server,T response:: #ffffffff000173437333140693031636f323431302e66652e75702e7074693031636f323431302e66652e75702e70742c36303032302c31333237363339303630363333,s{41,41,1327639068525,1327639068525,0,0,0,0,66,0,41} [DEBUG] hconnection-0x1351d745351000e Retrieved 66 byte(s) of data from znode /hbase/root-region-server and set watcher; \xFF\x00\x00\x00\x174731@i01c... Exception in thread "main" java.lang.IllegalArgumentException: Not a host:port pair: [email protected] ,60000,1327639058703 at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:60) at org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress( MasterAddressTracker.java:63) at org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster( HConnectionManager.java:561) at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:99) at org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable( HBaseAdmin.java:1320) at pt.sapo.labs.crawl.twitter.JBase.main(JBase.java:44) -- Arian Pasquali FEUP researcher twitter: @arianpasquali www.arianpasquali.com
