HBaseTestingUtility设置配置Zookeeper clientPort不起作用

时间:2015-09-24 02:45:40

标签: configuration hbase apache-zookeeper hbasetestingutility

我使用HBaseTestingUtility进行集成测试。我希望Zookeeper能够收听端口2181

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 个答案:

答案 0 :(得分:2)

试试这个:

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