1

我使用HBaseTestingUtility进行集成测试。我想要Zookeeper监听端口2181HBaseTestingUtility set配置Zookeeper clientPort不工作

HBaseTestingUtility testUtil = new HBaseTestingUtility(); 
testUtil.getConfiguration().set("hbase.zookeeper.property.clientPort", "2181"); 
MiniHBaseCluster cluster = testUtil.startMiniCluster(); 

但是,每当测试运行时,Zookeeper都会随时监听随机端口。

LOG: Started MiniZK Cluster and connect 1 ZK server on client port: 62251 

这里有什么问题?

回答

1

试试这个:

HBaseTestingUtility testUtil = new HBaseTestingUtility(); 
testUtil.getConfiguration().set("test.hbase.zookeeper.property.clientPort", "2181"); 
MiniHBaseCluster cluster = testUtil.startMiniCluster();