docker - Not able to connect to HBase ( Zookeeper ) running on Vagrant -


i have simple vagrant machine has stand alone instance on hbase. when start hbase, i'm able access access hbase information url http://192.168.99.101:16010/master-status.

but when try connect through java, i'm not able connect zookeeper.

vagrant file

vagrant.configure("2") |config|   config.vm.box = "hbase-phoenix"  # simple hbase phoenix box   config.vm.box_check_update = false   config.vbguest.auto_update = false   config.vm.define "hbase_pnx" |hbase_pnx|     hbase_pnx.vm.hostname = "hbasepnx"     hbase_pnx.vm.network "private_network", ip: "192.168.99.101"     hbase_pnx.vm.network "forwarded_port", guest: 2181, host: 2181     hbase_pnx.vm.network "forwarded_port", guest: 16010, host: 16010   end end 

the host file on vm looks like

vagrant@hbasepnx:~$ cat /etc/hosts 192.168.99.101  hbasepmx        hbasepnx 192.168.99.101  hbase-vm        hbase-vm 192.168.99.101  localhost ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts 

hbase-site.xml looks like

<configuration>   <property>     <name>hbase.rootdir</name>     <value>file:///home/vagrant/data/hbase</value>   </property>   <property>     <name>hbase.zookeeper.property.datadir</name>     <value>/home/vagrant/data/zookeeper</value>   </property>   <property>     <name>hbase.cluster.distributed</name>     <value>false</value>   </property> </configuration> 

simple test code looks like

public void testhbasecrud() throws exception {         configuration config = hbaseconfiguration.create();         config.set("hbase.zookeeper.quorum", "192.168.99.101");         config.set("hbase.zookeeper.property.clientport", "2181");         try (htable htable = new htable(config, tablename)) {             int total = 100;             long t1 = system.currenttimemillis();             (int = 0; < total; i++) {                 int userid = i;                 string email = "user-" + + "@foo.com";                 string phone = "555-1234";                  byte[] key = bytes.tobytes(userid);                 put put = new put(key);                  put.add(bytes.tobytes(familyname), bytes.tobytes("first_name"), bytes.tobytes(email));  // <-- email goes here                 put.add(bytes.tobytes(familyname), bytes.tobytes("last_name"), bytes.tobytes(phone));  // <-- phone goes here                 htable.put(put);          }         long t2 = system.currenttimemillis();         system.out.println("inserted " + total + " users  in " + (t2 - t1) + " ms");      } 

hbase version hbase-1.1.9

2017-03-28 10:06:01,422 info  [main-sendthread(192.168.99.101:2181)] zookeeper.clientcnxn (clientcnxn.java:primeconnection(852)) - socket connection established 192.168.99.101/192.168.99.101:2181, initiating session 2017-03-28 10:06:01,427 info  [main-sendthread(192.168.99.101:2181)] zookeeper.clientcnxn (clientcnxn.java:onconnected(1235)) - session establishment complete on server 192.168.99.101/192.168.99.101:2181, sessionid = 0x15b1534b9900009, negotiated timeout = 40000 2017-03-28 10:06:50,084 info  [hconnection-0x4206a205-metalookup-shared--pool2-t1] client.rpcretryingcaller (rpcretryingcaller.java:callwithretries(142)) - call exception, tries=10, retries=35, started=48438 ms ago, cancelled=false, msg=row 'user,    ,99999999999999' on table 'hbase:meta' @ region=hbase:meta,,1.1588230740, hostname=hbasepmx,37628,1490709431477, seqnum=0 2017-03-28 10:07:02,605 info  [hconnection-0x4206a205-metalookup-shared--pool2-t1] client.rpcretryingcaller (rpcretryingcaller.java:callwithretries(142)) - call exception, tries=11, retries=35, started=60963 ms ago, cancelled=true, msg=row 'user,    ,99999999999999' on table 'hbase:meta' @ region=hbase:meta,,1.1588230740, hostname=hbasepmx,37628,1490709431477, seqnum=0 2017-03-28 10:07:48,168 info  [hconnection-0x4206a205-metalookup-shared--pool2-t2] client.rpcretryingcaller (rpcretryingcaller.java:callwithretries(142)) - call exception, tries=10, retries=35, started=46421 ms ago, cancelled=false, msg=row 'user,    ,99999999999999' on table 'hbase:meta' @ region=hbase:meta,,1.1588230740, hostname=hbasepmx,37628,1490709431477, seqnum=0 2017-03- 

any appreciated. thanks

apparently question has answer in unable connect hbase stand alone server windows remote client

the problem zookeeper connects using host-name , not ip

so in windows host file need add

192.168.99.101  hbasepmx        hbasepnx 192.168.99.101  hbase-vm        hbase-vm 

and in code change ,

config.set("hbase.zookeeper.quorum", "hbase-vm"); 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -