I got it work by add the hosts file in the sever to client and it's fine.
On Mon, Jan 6, 2014 at 1:37 AM, Jean-Marc Spaggiari <[email protected]> wrote: > What do you have in you host file for wangzhongxin.HOLD.FOUNDER.COM? Can > you paste your hosts file here? > > > 2014/1/5 Haosong Huang <[email protected]> > >> And I also add "hbase.master" property to the hbase-site.xml in HBase >> server. >> >> >> On Sun, Jan 5, 2014 at 11:17 PM, Haosong Huang <[email protected]> wrote: >> >> > I ever try to connect a standalone remote hbase. I remember I connect it >> > successfully after I set "hbase.master" to "x.x.x.x:xxx" in >> "Configuration". >> > >> > >> > On Sun, Jan 5, 2014 at 11:00 PM, Jean-Marc Spaggiari < >> > [email protected]> wrote: >> > >> >> What do you have in you host file for wangzhongxin.HOLD.FOUNDER.COM ? >> >> >> >> >> >> 2014/1/5 Li Li <[email protected]> >> >> >> >> > yes, I test with telnet >> >> > I found a similar mail and a jira issue: >> >> > >> >> > >> >> >> http://apache-hbase.679495.n3.nabble.com/Connecting-to-standalone-HBase-from-a-remote-client-td4034362.html >> >> > https://issues.apache.org/jira/browse/HBASE-7219 >> >> > But I can't find a solution. >> >> > Maybe I need to modify the host, I'll try it tomorrow >> >> > >> >> > On Sun, Jan 5, 2014 at 10:25 PM, Haosong Huang <[email protected]> >> >> wrote: >> >> > > Could you connect zookeeper correctly? >> >> > > >> >> > > >> >> > > On Sun, Jan 5, 2014 at 8:28 PM, Li Li <[email protected]> wrote: >> >> > > >> >> > >> yes, I just want to setup a test environment >> >> > >> >> >> > >> On Sun, Jan 5, 2014 at 6:48 PM, Ted Yu <[email protected]> >> wrote: >> >> > >> > For hbase.rootdir, hdfs was not used. >> >> > >> > >> >> > >> > Is that intended ? >> >> > >> > >> >> > >> > Thanks >> >> > >> > >> >> > >> > On Jan 4, 2014, at 10:46 PM, Li Li <[email protected]> wrote: >> >> > >> > >> >> > >> >> hi all, >> >> > >> >> I am new to hbase and encounter a problem of client >> >> connection. I >> >> > >> >> download latest stable version(0.94.15) and start the server >> >> > >> >> successfully. And I can use ./bin/hbase shell to connect to >> >> server in >> >> > >> >> local, But I can't connect to the server using a remote java >> >> client. >> >> > >> >> My setup configures: >> >> > >> >> 1. OS >> >> > >> >> Centos 5.5 >> >> > >> >> 2. HBase >> >> > >> >> 0.94.15 standalone mode >> >> > >> >> 3. hbase-site.xml >> >> > >> >> <configuration> >> >> > >> >> <property> >> >> > >> >> <name>hbase.rootdir</name> >> >> > >> >> <value>file:///home/lili/hbasedata</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.zookeeper.property.dataDir</name> >> >> > >> >> <value>/home/lili/zookeeperdata</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.master.port</name> >> >> > >> >> <value>61000</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.master.info.port</name> >> >> > >> >> <value>61010</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.regionserver.port</name> >> >> > >> >> <value>61020</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.regionserver.info.port</name> >> >> > >> >> <value>61030</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.zookeeper.leaderport</name> >> >> > >> >> <value>63888</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.zookeeper.property.clientPort</name> >> >> > >> >> <value>62181</value> >> >> > >> >> </property> >> >> > >> >> <property> >> >> > >> >> <name>hbase.rest.port</name> >> >> > >> >> <value>58080</value> >> >> > >> >> </property> >> >> > >> >> </configuration> >> >> > >> >> >> >> > >> >> 4. remote http test to master >> >> > >> >> http://server-ip:61010/master-status correct >> >> > >> >> >> >> > >> >> 5. region server http >> >> > >> >> http://server-ip::61030 correct >> >> > >> >> >> >> > >> >> 6. remote client test(windows) >> >> > >> >> telnet server-ip 62181 correct >> >> > >> >> >> >> > >> >> 7. java program >> >> > >> >> >> >> > >> >> Configuration myConf = HBaseConfiguration.create(); >> >> > >> >> myConf.set("hbase.zookeeper.quorum", "172.19.34.35"); >> >> > >> >> myConf.set("hbase.zookeeper.property.clientPort", "62181"); >> >> > >> >> HTableInterface usersTable = new HTable(myConf, "users"); >> >> > >> >> { >> >> > >> >> Put p = new Put(Bytes.toBytes("TheRealMT")); >> >> > >> >> p.add(Bytes.toBytes("info"), Bytes.toBytes("name"), >> >> > >> >> Bytes.toBytes("Mark Twain")); >> >> > >> >> p.add(Bytes.toBytes("info"), Bytes.toBytes("email"), >> >> > >> >> Bytes.toBytes("[email protected]")); >> >> > >> >> p.add(Bytes.toBytes("info"), Bytes.toBytes("password"), >> >> > >> >> Bytes.toBytes("Langhorne")); >> >> > >> >> usersTable.put(p); >> >> > >> >> } >> >> > >> >> { >> >> > >> >> Put p = new Put(Bytes.toBytes("TheRealMT")); >> >> > >> >> p.add(Bytes.toBytes("info"), >> >> > >> >> Bytes.toBytes("password"), >> >> > >> >> Bytes.toBytes("abc123")); >> >> > >> >> usersTable.put(p); >> >> > >> >> } >> >> > >> >> usersTable.close(); >> >> > >> >> >> >> > >> >> When runing this program, it hangs at this line: HTableInterface >> >> > >> >> usersTable = new HTable(myConf, "users"); >> >> > >> >> I have checked in hbase shell by scan 'users', it's an empty >> table >> >> > >> >> >> >> > >> >> >> >> > >> >> After very long time, it throws an exception: >> >> > >> >> >> >> > >> >> 14-01-05 14:23:34,091 INFO main Environment Client >> >> > >> environment:zookeeper.version >> >> > >> >> =3.4.5-1392090, built on 09/30/2012 17:52 GMT >> >> > >> >> 14-01-05 14:23:34,122 INFO main Environment Client environment: >> >> > >> host.name=wangzho >> >> > >> >> ngxin.HOLD.FOUNDER.COM >> >> > >> >> 14-01-05 14:23:34,122 INFO main Environment Client >> >> > >> environment:java.version=1.7. >> >> > >> >> 0_45 >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:java.vendor=Oracl >> >> > >> >> e Corporation >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:java.home=C:\Prog >> >> > >> >> ram Files\Java\jdk1.7.0_45\jre >> >> > >> >> >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:java.io.tmpdir=C: >> >> > >> >> \DOCUME~1\lili.dz\LOCALS~1\Temp\ >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:java.compiler=<NA >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client environment: >> >> > os.name=Windows >> >> > >> X >> >> > >> >> P >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:os.arch=x86 >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:os.version=5.1 >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client environment: >> >> > >> user.name=lili.dz >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:user.home=C:\Docu >> >> > >> >> ments and Settings\lili.dz >> >> > >> >> 14-01-05 14:23:34,137 INFO main Environment Client >> >> > >> environment:user.dir=C:\Docum >> >> > >> >> ents and Settings\lili.dz\workspace\HBaseTest >> >> > >> >> 14-01-05 14:23:34,137 INFO main ZooKeeper Initiating client >> >> > connection, >> >> > >> connectS >> >> > >> >> tring=172.19.34.35:62181 sessionTimeout=180000 >> >> watcher=hconnection >> >> > >> >> 14-01-05 14:23:34,418 INFO main RecoverableZooKeeper The >> >> identifier >> >> > of >> >> > >> this proc >> >> > >> >> ess is [email protected] >> >> > >> >> 14-01-05 14:23:43,391 INFO main-SendThread(172.19.34.35:62181) >> >> > >> ClientCnxn$SendTh >> >> > >> >> read Opening socket connection to server >> >> > >> 172.19.34.35/172.19.34.35:62181. Will n >> >> > >> >> ot attempt to authenticate using SASL (unknown error) >> >> > >> >> 14-01-05 14:23:43,407 INFO main-SendThread(172.19.34.35:62181) >> >> > >> ClientCnxn$SendTh >> >> > >> >> read Socket connection established to >> >> > 172.19.34.35/172.19.34.35:62181, >> >> > >> initiatin >> >> > >> >> g session >> >> > >> >> 14-01-05 14:23:43,407 INFO main-SendThread(172.19.34.35:62181) >> >> > >> ClientCnxn$SendTh >> >> > >> >> read Session establishment complete on server >> >> > >> 172.19.34.35/172.19.34.35:62181, s >> >> > >> >> essionid = 0x1435626fec5000e, negotiated timeout = 40000 >> >> > >> >> Exception in thread "main" >> >> > >> org.apache.hadoop.hbase.client.NoServerForRegionExcep >> >> > >> >> tion: Unable to find region for users,,99999999999999 after 14 >> >> tries. >> >> > >> >> at >> >> > >> >> >> > >> >> >> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation. >> >> > >> >> locateRegionInMeta(HConnectionManager.java:1092) >> >> > >> >> at >> >> > >> >> >> > >> >> >> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation. >> >> > >> >> locateRegion(HConnectionManager.java:997) >> >> > >> >> at >> >> > >> >> >> > >> >> >> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation. >> >> > >> >> locateRegionInMeta(HConnectionManager.java:1099) >> >> > >> >> at >> >> > >> >> >> > >> >> >> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation. >> >> > >> >> locateRegion(HConnectionManager.java:1001) >> >> > >> >> at >> >> > >> >> >> > >> >> >> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation. >> >> > >> >> locateRegion(HConnectionManager.java:958) >> >> > >> >> at >> >> org.apache.hadoop.hbase.client.HTable.finishSetup(HTable.java:251) >> >> > >> >> at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:155) >> >> > >> >> at org.apache.hadoop.hbase.client.HTable.<init>(HTable.java:129) >> >> > >> >> at test.Test.main(Test.java:18) >> >> > >> >> >> > > >> >> > > >> >> > > >> >> > > -- >> >> > > Best Regards, >> >> > > Haosdent Huang >> >> > >> >> >> > >> > >> > >> > -- >> > Best Regards, >> > Haosdent Huang >> > >> >> >> >> -- >> Best Regards, >> Haosdent Huang >>
