Is there a way to call HbaseAdmin/Htable through sock proxy? I want to use localhost:1080 socks proxy mapped to one of the boxes in cluster and then talk to Hbase(Zookeeper, Master, RegionServer). Is there a way to do that?
Thanks.
I too had the same requirement and figured out that ZooKeeper client connection is implemented over NIO (org.apache.zookeeper.ClientCnxnSocketNIO). And NIO doesn't support connection over socks
Checkout the method getClientCnxnSocket() on ZooKeeper.java if you have the source.
private static ClientCnxnSocket getClientCnxnSocket() throws IOException {
String clientCnxnSocketName = System
.getProperty(ZOOKEEPER_CLIENT_CNXN_SOCKET);
if (clientCnxnSocketName == null) {
clientCnxnSocketName = ClientCnxnSocketNIO.class.getName();
}
try {
return (ClientCnxnSocket) Class.forName(clientCnxnSocketName)
.newInstance();
} catch (Exception e) {
IOException ioe = new IOException("Couldn't instantiate "
+ clientCnxnSocketName);
ioe.initCause(e);
throw ioe;
}
}
If you want to make it work over socks you need to provide your own implementation by extending ClientCnxnSocket and specify it using System variable zookeeper.clientCnxnSocket).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With