configuration之HBaseTestingUtility 设置配置 Zookeeper clientPort 不工作

熊孩纸 阅读:194 2025-05-04 20:05:19 评论:0

我使用 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 

这里有什么问题?

请您参考如下方法:

试试这个:

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


标签:zookeeper
声明

1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。

关注我们

一个IT知识分享的公众号