简体   繁体   中英

How to connect remotely to HBASE on EC2 with Java API

I have set up an Amazon EC2 cluster using the AWS Console with all the default settings by following Amazon's own tutorial ( http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-hbase-launch.html ). I have deployed an AMI 3.0.4 that runs Hadoop 2.2.0 and HBASE 0.94.7. I want to be able to run a java program on my own computer that will connect to HBASE using the JAVA API. Previously, I have been able to do this successfully using an Amazon EC2 instance that I set up myself but using a more recent version of HBASE (0.96.1.1-hadoop2) however I am getting the following error under this new cluster set up:

Exception in thread "main" org.apache.hadoop.hbase.MasterNotRunningException: com.google.protobuf.ServiceException: java.io.IOException: Call to <MY_EC2_MASTER_INTERNAL_HOST_NAME>/<THE_EC2_MASTER_EXTERNAL_IP>:60000 failed on local exception: java.io.IOException: Connection reset by peer

I have checked that the server is running, I have correctly mapped the EC2 internal host name to the public IP address in my local /etc/hosts file exactly as I had done with the Amazon instance I had set up myself. I also have the right ports open (2181, 60000, 60010, 60020, 60030 - probably don't even need all these) on Amazon and currently accepting traffic from all IP sources (temporarily until I have the setup done right and I resolve this issue).

My Java API is using the following configuration (and the last line causes the error):

Configuration config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", "<EC2_MASTER_PUBLIC_IP_ADDRESS>");
config.set("hbase.zookeeper.property.clientPort","2181");
this.conf = config;
this.tokenizer = ObjectFactory.createOpenNLPTokenizer();
HBaseAdmin.checkHBaseAvailable(this.conf);

Any idea what could be causing the problem? Could it be a mismatch between my version of the hbase client (0.96.1.1-hadoop2) and the fact that the Amazon HBase is 0.94.7? I cannot find the HBase client in the maven repository for this version which is why I am using the slightly newer version.

. Rather, copy the hbase jar from the lib folder of the AWS EMR cluster and put it in the lib folder of your local machine.
Now compile your code using copied hbase jar file in classpath ie javac -cp "hbase-jar-copied-location" filename.java and then run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM