Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
HBase, mail # user - Re: help needed towards connecting Hbase


+
Jean-Marc Spaggiari 2014-02-01, 01:58
+
Jean-Marc Spaggiari 2014-02-01, 10:14
Copy link to this message
-
Re: help needed towards connecting Hbase
Ted Yu 2014-02-01, 15:39
Moving dev@ to bcc.

Since hbase-0.96.1.1-hadoop2 is deployed in your cluster, you need to build
your client program with 0.96.1.1-hadoop2 maven dependency.

HServerAddress is gone in 0.96 and newer releases.

Cheers
On Sat, Feb 1, 2014 at 1:07 AM, jeevi tesh <[EMAIL PROTECTED]> wrote:

> hi,
> I changed the etc/hosts file now it looks like
> 127.0.0.1              localhost.localdomain.com          localhost
> 192.168.1.42              database.companyname.com      database
>
> I'm able to connect "http://192.168.1.42:60010/master-status?filter=all"
> and also to hbase shell and after issue of command "status" i get
> 1 server, 3 dead, 3.000 average load.
>
> There are no error but* no tables are getting created.*
> *Any suggestion or comments will be of great help.*
>
> *Hadoop and Hbase are in oracle linux os on completely different Vm.*
> *I'm connecting from my win7 machine through my java code.*
>
>
> *One interesting thing is if uncomment
> line*"HBaseAdmin.checkHBaseAvailable(config);
> "
> I get error
> 14/02/01 14:33:27 INFO zookeeper.ClientCnxn: Socket connection established
> to 192.168.1.42/192.168.1.42:2181, initiating session
> 14/02/01 14:33:27 INFO zookeeper.ClientCnxn: Session establishment complete
> on server 192.168.1.42/192.168.1.42:2181, sessionid = 0x143eca016d60010,
> negotiated timeout = 40000
> java.lang.NumberFormatException: For input string: "43535???]M??PBUF
> $
>  database.unilogcorp.com ??  ????(
>
> at
>
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> at java.lang.Integer.parseInt(Integer.java:458)
> at java.lang.Integer.parseInt(Integer.java:499)
> at org.apache.hadoop.hbase.HServerAddress.<init>(HServerAddress.java:63)
> at
>
> org.apache.hadoop.hbase.MasterAddressTracker.getMasterAddress(MasterAddressTracker.java:63)
> at
>
> org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation.getMaster(HConnectionManager.java:353)
> at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:89)
> at
>
> org.apache.hadoop.hbase.client.HBaseAdmin.checkHBaseAvailable(HBaseAdmin.java:1216)
> at pack1.testDB.main(testDB.java:30)
>
> below is my new script
> package pack1;
>
> import java.io.IOException;
>
> import org.apache.hadoop.conf.Configuration;
> import org.apache.hadoop.fs.Path;
> import org.apache.hadoop.hbase.HBaseConfiguration;
> import org.apache.hadoop.hbase.client.HBaseAdmin;
> 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.addResource(new Path("conf/hbase-site.xml"));
> System.setProperty("java.net.preferIPv4Stack" , "true");
> config.set("hbase.master", "192.168.1.42:60010");
> config.set("hbase.zookeeper.quorum", "192.168.1.42");
> config.set("hbase.zookeeper.property.clientPort","2181");
>  //HBaseAdmin.checkHBaseAvailable(config);
> System.out.println("HBase is running!");
>         HTable table;
>
>         table = new HTable(config, "test4");
>
>
>             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);
>            // table.close();
>
> } catch (Exception e) {
>  e.printStackTrace();
> }
>
> }
>
> }
> Output is as follows
> 1 Before HBASE COnfiguration
> 2 Before HBASE COnfiguration
> HBase is running!
> 14/02/01 14:22:59 INFO zookeeper.ZooKeeper: Client
> environment:zookeeper.version=3.3.2-1031432, built on 11/05/2010 05:32 GMT
> 14/02/01 14:22:59 INFO zookeeper.ZooKeeper: Client environment:host.name