Connecting to a remote HBase instance

2020-02-15 17:18发布

问题:

I have an HBase-0.98.3-hadoop2 instance running on a ubuntu VM, I could not connect to it (the main thread stuck when creating HTable instance) with the following code:

Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "192.168.56.101");
HTableInterface usersTable = new HTable(config, "users");

Here is what I got in the console

SLF4J: The requested version 1.5.8 by your slf4j binding is not compatible with [1.6, 1.7]
SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.3-1240972, built on 02/06/2012 10:48 GMT
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:host.name=EL-OUED
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.version=1.7.0_45
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Oracle Corporation
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.home=C:\Program Files\Java\jdk1.7.0_45\jre
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.class.path=D:\User\Arbi\workspaces\formation\hbase-samples\target\test-classes;D:\User\Arbi\workspaces\formation\hbase-samples\target\classes;D:\Work\maven-repo\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar;D:\Work\maven-repo\javax\xml\bind\jaxb-api\2.2.1\jaxb-api-2.2.1.jar;D:\Work\maven-repo\javax\activation\activation\1.1\activation-1.1.jar;D:\Work\maven-repo\junit\junit\3.8.1\junit-3.8.1.jar;D:\Work\maven-repo\org\apache\lucene\lucene-core\3.6.2\lucene-core-3.6.2.jar;D:\Work\maven-repo\org\apache\lucene\lucene-analyzers\3.6.2\lucene-analyzers-3.6.2.jar;D:\Work\maven-repo\org\apache\hbase\hbase\0.92.1\hbase-0.92.1.jar;D:\Work\maven-repo\com\google\guava\guava\17.0\guava-17.0.jar;D:\Work\maven-repo\commons-cli\commons-cli\1.2\commons-cli-1.2.jar;D:\Work\maven-repo\commons-configuration\commons-configuration\1.6\commons-configuration-1.6.jar;D:\Work\maven-repo\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;D:\Work\maven-repo\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;D:\Work\maven-repo\commons-logging\commons-logging\1.1.2\commons-logging-1.1.2.jar;D:\Work\maven-repo\commons-digester\commons-digester\1.8\commons-digester-1.8.jar;D:\Work\maven-repo\commons-beanutils\commons-beanutils\1.9.1\commons-beanutils-1.9.1.jar;D:\Work\maven-repo\commons-beanutils\commons-beanutils-core\1.8.0\commons-beanutils-core-1.8.0.jar;D:\Work\maven-repo\com\github\stephenc\high-scale-lib\high-scale-lib\1.1.1\high-scale-lib-1.1.1.jar;D:\Work\maven-repo\commons-codec\commons-codec\1.4\commons-codec-1.4.jar;D:\Work\maven-repo\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;D:\Work\maven-repo\log4j\log4j\1.2.16\log4j-1.2.16.jar;D:\Work\maven-repo\org\apache\avro\avro\1.5.3\avro-1.5.3.jar;D:\Work\maven-repo\org\codehaus\jackson\jackson-mapper-asl\1.5.5\jackson-mapper-asl-1.5.5.jar;D:\Work\maven-repo\org\codehaus\jackson\jackson-core-asl\1.5.5\jackson-core-asl-1.5.5.jar;D:\Work\maven-repo\org\xerial\snappy\snappy-java\1.0.3.2\snappy-java-1.0.3.2.jar;D:\Work\maven-repo\org\slf4j\slf4j-api\1.7.7\slf4j-api-1.7.7.jar;D:\Work\maven-repo\org\apache\avro\avro-ipc\1.5.3\avro-ipc-1.5.3.jar;D:\Work\maven-repo\org\mortbay\jetty\jetty\6.1.26\jetty-6.1.26.jar;D:\Work\maven-repo\org\mortbay\jetty\jetty-util\6.1.26\jetty-util-6.1.26.jar;D:\Work\maven-repo\org\jboss\netty\netty\3.2.4.Final\netty-3.2.4.Final.jar;D:\Work\maven-repo\org\apache\velocity\velocity\1.7\velocity-1.7.jar;D:\Work\maven-repo\org\apache\zookeeper\zookeeper\3.4.3\zookeeper-3.4.3.jar;D:\Work\maven-repo\org\slf4j\slf4j-log4j12\1.5.8\slf4j-log4j12-1.5.8.jar;D:\Work\maven-repo\org\apache\thrift\libthrift\0.7.0\libthrift-0.7.0.jar;D:\Work\maven-repo\org\apache\httpcomponents\httpclient\4.0.1\httpclient-4.0.1.jar;D:\Work\maven-repo\org\apache\httpcomponents\httpcore\4.0.1\httpcore-4.0.1.jar;D:\Work\maven-repo\org\jruby\jruby-complete\1.6.5\jruby-complete-1.6.5.jar;D:\Work\maven-repo\org\mortbay\jetty\jsp-2.1\6.1.14\jsp-2.1-6.1.14.jar;D:\Work\maven-repo\org\eclipse\jdt\core\3.1.1\core-3.1.1.jar;D:\Work\maven-repo\org\mortbay\jetty\jsp-api-2.1\6.1.14\jsp-api-2.1-6.1.14.jar;D:\Work\maven-repo\org\mortbay\jetty\servlet-api-2.5\6.1.14\servlet-api-2.5-6.1.14.jar;D:\Work\maven-repo\org\codehaus\jackson\jackson-jaxrs\1.9.13\jackson-jaxrs-1.9.13.jar;D:\Work\maven-repo\org\codehaus\jackson\jackson-xc\1.5.5\jackson-xc-1.5.5.jar;D:\Work\maven-repo\tomcat\jasper-compiler\5.5.23\jasper-compiler-5.5.23.jar;D:\Work\maven-repo\tomcat\jasper-runtime\5.5.23\jasper-runtime-5.5.23.jar;D:\Work\maven-repo\commons-el\commons-el\1.0\commons-el-1.0.jar;D:\Work\maven-repo\org\jamon\jamon-runtime\2.3.1\jamon-runtime-2.3.1.jar;D:\Work\maven-repo\com\google\protobuf\protobuf-java\2.4.0a\protobuf-java-2.4.0a.jar;D:\Work\maven-repo\com\sun\jersey\jersey-core\1.4\jersey-core-1.4.jar;D:\Work\maven-repo\com\sun\jersey\jersey-json\1.4\jersey-json-1.4.jar;D:\Work\maven-repo\org\codehaus\jettison\jettison\1.3.5\jettison-1.3.5.jar;D:\Work\maven-repo\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\Work\maven-repo\com\sun\xml\bind\jaxb-impl\2.1.12\jaxb-impl-2.1.12.jar;D:\Work\maven-repo\com\sun\jersey\jersey-server\1.4\jersey-server-1.4.jar;D:\Work\maven-repo\asm\asm\3.1\asm-3.1.jar;D:\Work\maven-repo\org\mapdb\mapdb\1.0.2\mapdb-1.0.2.jar;D:\Work\maven-repo\com\akiban\akiban-persistit\3.3.0\akiban-persistit-3.3.0.jar;D:\Work\maven-repo\org\apache\hadoop\hadoop-core\1.2.1\hadoop-core-1.2.1.jar;D:\Work\maven-repo\xmlenc\xmlenc\0.52\xmlenc-0.52.jar;D:\Work\maven-repo\commons-io\commons-io\2.1\commons-io-2.1.jar;D:\Work\maven-repo\org\apache\commons\commons-math\2.1\commons-math-2.1.jar;D:\Work\maven-repo\commons-net\commons-net\1.4.1\commons-net-1.4.1.jar;D:\Work\maven-repo\oro\oro\2.0.8\oro-2.0.8.jar;D:\Work\maven-repo\net\java\dev\jets3t\jets3t\0.6.1\jets3t-0.6.1.jar;D:\Work\maven-repo\hsqldb\hsqldb\1.8.0.10\hsqldb-1.8.0.10.jar
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_45\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Java\jdk1.7.0_45\bin;C:\bin\apache-maven-3.2.1\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\TortoiseSVN\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;.
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=C:\Users\Arbi\AppData\Local\Temp\
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:os.name=Windows 7
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:os.arch=amd64
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:os.version=6.1
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:user.name=Arbi
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:user.home=C:\Users\Arbi
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Client environment:user.dir=D:\User\Arbi\workspaces\formation\hbase-samples
14/06/14 12:40:05 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=192.168.56.101:2181 sessionTimeout=180000 watcher=hconnection
14/06/14 12:40:05 INFO zookeeper.ClientCnxn: Opening socket connection to server /192.168.56.101:2181
14/06/14 12:40:05 INFO zookeeper.RecoverableZooKeeper: The identifier of this process is 6912@EL-OUED
14/06/14 12:40:10 INFO client.ZooKeeperSaslClient: Client will not SASL-authenticate because the default JAAS configuration section 'Client' could not be found. If you are not using SASL, you may ignore this. On the other hand, if you expected SASL to work, please fix your JAAS configuration.
14/06/14 12:40:10 INFO zookeeper.ClientCnxn: Socket connection established to 192.168.56.101/192.168.56.101:2181, initiating session
14/06/14 12:40:10 INFO zookeeper.ClientCnxn: Session establishment complete on server 192.168.56.101/192.168.56.101:2181, sessionid = 0x14699e94b5d0005, negotiated timeout = 40000

In the hbase-site.xml I've only set the hbase.rootdir property. Any idea what I'm missing here?