在读取hbase表时挂起Mapreduce作业

时间:2015-10-02 18:30:49

标签: hadoop mapreduce hbase bigdata distributed-computing

我有一个4节点的hadoop分布式集群(包括hbase)设置如下。

  • node1 - namenode + hbase master + zookeeper
  • node2 - resourcemanager
  • node3 - datanode1 + hbase regionserver1 + nodemanager
  • node4 - datenode2 + hbase regionserver2 + nodemanager

集群设置似乎很好,因为所有的WEB UI(hbase,namenode,资源管理器)都会出现。现在,当我尝试提交读取/写入hbase表的mapreduce作业时,它会被挂起。它一直在喋喋不休 然而,如果我在mapreduce代码中明确提到hbase凭据并将其设置为job

,那么同样的工作也能正常工作
Configuration conf =  HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum", "10.211.55.101");
conf.set("hbase.zookeeper.property.clientPort","2181");
conf.set("hbase.master", "10.211.55.101:60000");
//10.211.55.101 is the ipaddress of node1

这些属性已在node1,node3和node4上的hbase配置中设置。现在我的问题是我是否需要在node2上设置有关hbase配置的任何内容,其中只有资源管理器正在运行?当代码明确设置hbase配置时,为什么同样的工作正常工作

1 个答案:

答案 0 :(得分:1)

HBaseConfiguration.create()方法加载hbase-site.xml中的配置。确保在Node2的类路径中有hbase-site.xml。

以下内容在HBase文档here

中指定
  

Java客户端使用的配置保存在   HBaseConfiguration实例。 HBaseConfiguration上的工厂方法,   调用时,HBaseConfiguration.create();将读入内容   在客户端的CLASSPATH中找到的第一个hbase-site.xml,如果有的话   present(调用也会考虑任何找到的hbase-default.xml;   hbase-default.xml发布在hbase.X.X.X.jar)