Thanks to 梁景明 and Tatsuya Kawano. I use HBase 0.20.0, I did follow what 梁景明 said, write my code as
   HBaseConfiguration config = new HBaseConfiguration();
   config.addResource("./conf/hbase-site.xml");
Then run it on my client PC. but it cann't work and get following message, is my running way correct? or need something else be configured. Thanks again.

09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:zookeeper.version=3.2.1-808558, built on 08/27/2009 18:48 GMT 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:host.name=node0 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.version=1.6.0_16 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.vendor=Sun Microsystems Inc. 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.home=/usr/java/jdk1.6.0_16/jre 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.class.path=/home/audr/eclipse/workspace/HBaseSimpleTest/bin:/home/audr/eclipse/workspace/HBaseTest/lib/caliph-emir-cbir.jar:/home/audr/eclipse/workspace/HBaseTest/lib/commons-logging-1.1.1.jar:/home/audr/eclipse/workspace/HBaseTest/lib/hadoop-0.20.1-core.jar:/home/audr/eclipse/workspace/HBaseTest/lib/hbase-0.20.0.jar:/home/audr/eclipse/workspace/HBaseTest/lib/Jama-1.0.2.jar:/home/audr/eclipse/workspace/HBaseTest/lib/log4j-1.2.15.jar:/home/audr/eclipse/workspace/HBaseTest/lib/metadata-extractor.jar:/home/audr/eclipse/workspace/HBaseTest/lib/zookeeper-3.2.1.jar 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.library.path=/usr/java/jdk1.6.0_16/jre/lib/i386/client:/usr/java/jdk1.6.0_16/jre/lib/i386:/usr/java/jdk1.6.0_16/jre/../lib/i386:/usr/java/jdk1.6.0_16/jre/lib/i386/client:/usr/java/jdk1.6.0_16/jre/lib/i386:/usr/lib/xulrunner-1.9:/usr/lib/xulrunner-1.9:/usr/java/packages/lib/i386:/lib:/usr/lib 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:os.name=Linux
09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:os.arch=i386
09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:os.version=2.6.18-128.el5 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:user.name=audr 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:user.home=/home/audr 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Client environment:user.dir=/home/audr/eclipse/workspace/HBaseSimpleTest 09/10/27 10:57:28 INFO zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=60000 watcher=org.apache.hadoop.hbase.client.hconnectionmanager$clientzkwatc...@13c6641 09/10/27 10:57:28 INFO zookeeper.ClientCnxn: zookeeper.disableAutoWatchReset is false 09/10/27 10:57:28 INFO zookeeper.ClientCnxn: Attempting connection to server localhost/127.0.0.1:2181 09/10/27 10:57:28 WARN zookeeper.ClientCnxn: Exception closing session 0x0 to sun.nio.ch.selectionkeyi...@1f4bcf7
java.net.ConnectException: Connection refused
        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:933)



--------------------------------------------------
From: "Tatsuya Kawano" <[email protected]>
Sent: Tuesday, October 27, 2009 10:47 AM
To: <[email protected]>; <[email protected]>
Subject: Re: How to run java program

Hi,

On Tue, Oct 27, 2009 at 10:06 AM, Liu Xianglong <[email protected]> wrote:
Sorry about that I haven't receive any reply. Thanks for you help, I will
read them.

That's okay. You can check the mailing list archive if this happens again:
http://www.nabble.com/HBase-User-f34655.html


So, I'm a bit late to reply, but you have found a way to get your
program working; that's great!  As for "hbase-site.xml", please try
what 梁景明 said. (I'm forwarding the email just for sure.)

Also, are you running HBase 0.19? I would suggest to move to HBase
0.20.1, because there are lots of improvements in HBase 0.20. When you
use HBase 0.20.x, you no longer use "hbase.master", but
"hbase.zookeeper.quorum", so update your "hbase-site.xml". Take a look
at "hbase-default.xml", it has all the default properties including
"hbase.zookeeper.quorum".

Thanks,
Tatsuya

--
Tatsuya Kawano (Mr.)
Tokyo, Japan




On Tue, Oct 27, 2009 at 10:57 AM, 梁景明 <[email protected]> wrote:
hi , at first u should add the configure files in hbase to ur HBaseConfiguration
like this
conf.addResource("/hbase-site.xml");
and the file in ur hbase conf path.
if u change ur hbase conf ,just change it.




2009/10/27, Liu Xianglong <[email protected]>:
Now, I can run my program correctly if I add sentence
"config.set("hbase.master","<hmaster IP>:60000")", otherwise it will report
the error I mentioned in last emails. So what do you think about the
problem? Should I change some configuration? Now I do not add "hbase.master"
in hbase-site for full-distributed mode.
--------------------------------------------------
From: "Tatsuya Kawano" <[email protected]>
Sent: Tuesday, October 27, 2009 9:03 AM
To: <[email protected]>; <[email protected]>
Subject: Re: How to run java program

Hi Liu,

You didn't receive any email by some reason?
We have been trying to answer your question for a week.

http://www.nabble.com/Qustion-about-HBase-error-td25969212.html
http://www.nabble.com/java-api-error%3A-connection-to-HMaster-td25976824.html
http://www.nabble.com/How-to-run-java-program-td26058149.html


So why don't you start to read above answers?

Thanks,

--
Tatsuya Kawano (Mr.)
Tokyo, Japan



2009/10/27 Liu Xianglong <[email protected]>:
would someone can answer my question? thanks a lot!

--------------------------------------------------
From: "Liu Xianglong" <[email protected]>
Sent: Monday, October 26, 2009 7:36 PM
To: <[email protected]>
Subject: How to run java program

Hi, everyone. I am using HBase Java API to retrieve data in HTable. Now
I
run my java program in HMaster node, but I am wondering whether there
are
other ways to run java program, or need I copy my java program into
server
every time I want to run them?

Thanks!


Best Wishes!
_____________________________________________________________

刘祥龙  Liu Xianglong




Reply via email to