I am writing a MapReduce job which reads from (a) HBase table(s). Almost everything works as it is supposed to except the Configuration
class. So I did this,
Configuration config = HBaseConfiguration.create();
GenericOptionsParser parser = new GenericOptionsParser(config, args);
// This should work but is not working.
config.addResource(new Path(parser.getCommandLine().getOptionValue("conf", DEFAULT_HBASE_CONF)));
When I run the job like this (passing the path to hbase-site.xml
correctly), I get this error.
14/06/30 23:02:30 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:735)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1075)
14/06/30 23:02:30 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
But when I add the following two lines, it works like a charm (even though it seems completely ridiculous).
// So these are the workarounds.
config.set("hbase.rootdir", config.get("hbase.rootdir"));
config.set("hbase.zookeeper.quorum", config.get("hbase.zookeeper.quorum"));
Basically, read the parameters back from the Configuration
object and set them back in the same object, which is bonkers.
I read a bug raised about it HBASE-11066, but it seems to have been closed citing local configuration problem (I think not) and a SO question here which is probably similar to my query, but with no answer yet. I use CDH 5.0.2 with HBase 0.96.1.1. Any insight would be deeply appreciated.