Hi, we had the problem, that the Job instance instantiated by Spring haven't had the hbase.zookeeper.quorum property set we specified in the applicationContext.xml. We solved it by putting the hbase config into the hdp:configuration element.
Our initial applicationContext was like this:
Then we tried to execute a job like this:Code:... <hdp:configuration id="hadoopConfiguration"> fs.defaultFS=hdfs://namenode.example.com:8020 </hdp:configuration> <hdp:hbase-configuration id="hbaseConfiguration" configuration-ref="hadoopConfiguration"> hbase.zookeeper.quorum=zookeeper1.example.com </hdp:hbase-configuration> <bean id="hbaseTemplate" class="org.springframework.data.hadoop.hbase.HbaseTemplate"> <property name="configuration" ref="hbaseConfiguration" /> </bean> <hdp:job id="exampleJob" input-path="hdfs://namenode.example.com:/examples/data/big.data.txt" output-path="" mapper="com.example.ExampleMapper" reducer="com.example.ExampleReducer"/> ...
Code:public static void main(final String[] args) throws Exception { final ApplicationContext ctx = new ClassPathXmlApplicationContext("/application-context.xml"); final Configuration conf = (Configuration) ctx.getBean("hbaseConfiguration"); final Job job = (Job) ctx.getBean("exampleJob"); job.setInputFormatClass(TextInputFormat.class); job.setMapOutputKeyClass(ImmutableBytesWritable.class); job.setMapOutputValueClass(Put.class); TableMapReduceUtil.initTableReducerJob("exampleTable", ExampleReducer.class, job); job.waitForCompletion(true); }
This leads into the following exception.
We figured out it is because our Configuration instance retrieved with Configuration conf = (Configuration) ctx.getBean("hbaseConfiguration"); doesn't had the hbase.zookeeper.quorum=zookeeper1.example.com property set. That's the reason why /hbase/master occurs in the stacktrace.Code:13/02/18 18:37:05 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:692) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:286) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1047) 13/02/18 18:37:05 WARN zookeeper.RecoverableZooKeeper: Possibly transient ZooKeeper exception: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/master
Workaround
To tackle this, we just specified the property in the hdp:configuration element like this:
And all our problems are solvedCode:... <hdp:configuration id="hadoopConfiguration"> fs.defaultFS=hdfs://namenode.example.com:8020 hbase.zookeeper.quorum=zookeeper1.example.com </hdp:configuration> <hdp:hbase-configuration id="hbaseConfiguration" configuration-ref="hadoopConfiguration"> </hdp:hbase-configuration> <bean id="hbaseTemplate" class="org.springframework.data.hadoop.hbase.HbaseTemplate"> <property name="configuration" ref="hbaseConfiguration" /> </bean> <hdp:job id="exampleJob" input-path="hdfs://namenode.example.com:/examples/data/big.data.txt" output-path="" mapper="com.example.ExampleMapper" reducer="com.example.ExampleReducer"/> ....
Maybe someone can clarify why it is like this and whether we did it correct.
Best Regards,
Christian.


.
Reply With Quote
