所以我试图使用自定义jar在Amazon ec2上查询我的hbase集群,我将其作为MapReduce步骤启动.我的jar(在map函数内)我将Hbase称为:
public void map( Text key, BytesWritable value, Context contex ) throws IOException, InterruptedException { Configuration conf = HBaseConfiguration.create(); HTable table = new HTable(conf, "tablename"); ...
问题是,当它到达HTable线并尝试连接到hbase时,步骤失败,我得到以下错误:
2014-02-28 18:00:49,936 INFO [main] org.apache.zookeeper.ZooKeeper: Initiating client connection, connectString=localhost:2181 sessionTimeout=180000 watcher=hconnection 2014-02-28 18:00:49,974 INFO [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper: The identifier of this process is 5119@ip-10-0-35-130.ec2.internal 2014-02-28 18:00:49,998 INFO [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2014-02-28 18:00:50,005 WARN [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused ... 2014-02-28 18:01:05,542 WARN [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid 2014-02-28 18:01:05,542 ERROR [main] org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper: ZooKeeper exists failed after 3 retries 2014-02-28 18:01:05,542 WARN [main] org.apache.hadoop.hbase.zookeeper.ZKUtil: hconnection Unable to set watcher on znode (/hbase/hbaseid) org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid ... and on and on
我可以很好地使用hbase shell,并且可以从shell查询数据和所有内容.我不知道从哪里开始,我一直在谷歌搜索几个小时没有运气.在互联网上这样的大多数问题都没有谈到亚马逊特定的修复.我认为zookeeper和hbase应该通过亚马逊引导程序自动连接.
我使用hbase 0.94.17 jar和亚马逊运行hbase 0.94.7我很确定这不是问题,我猜它更多我没有正确设置Java代码.如果有人可以提供帮助,那就非常感谢.谢谢