Hbase API through a proxy server

Is there a way to call HbaseAdmin / Htable through a sock proxy? I want to use localhost: proxy proxy 1080, mapped to one of the fields in the cluster, and then talk to Hbase (Zookeeper, Master, RegionServer). Is there any way to do this?

Thanks.

+4
source share
1 answer

I also had the same requirement, and it turned out that the connection to the ZooKeeper client was implemented through NIO (org.apache.zookeeper.ClientCnxnSocketNIO). And NIO does not support socks

Make the getClientCnxnSocket () method on ZooKeeper.java if you have a 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 it to work on socks, you need to provide your own implementation by extending ClientCnxnSocket and specifying it using System variable zookeeper.clientCnxnSocket).

+3
source

Source: https://habr.com/ru/post/1501119/


All Articles