yangl commented on a change in pull request #10715:
URL: https://github.com/apache/pulsar/pull/10715#discussion_r642972693
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -1022,6 +1025,28 @@ public ZooKeeper getZkClient() {
return this.localZooKeeperConnectionProvider.getLocalZooKeeper();
}
+ // get bookkeeper's zookeeper
+ public ZooKeeper getBookieZkClient() {
+ ZooKeeper zkClient = null;
+ String bookkeeperMetadataServiceUri =
config.getBookkeeperMetadataServiceUri();
+ if (StringUtils.isBlank(bookkeeperMetadataServiceUri)) {
+ bookkeeperMetadataServiceUri =
PulsarService.bookieMetadataServiceUri(config);
+ }
+
+ URI uri = URI.create(bookkeeperMetadataServiceUri);
+ String path = ZkUtils.trimLedgersDefaultRootPath(uri.getPath());
+ String bookieZkConnect = StringUtils.replace(uri.getAuthority(), ";",
",") + path;
+
+ int zkTimeout = (int) config.getZooKeeperSessionTimeoutMillis();
+ try {
+ zkClient =
ZooKeeperClient.newBuilder().connectString(bookieZkConnect)
+ .sessionTimeoutMs(zkTimeout).build();
+ } catch (Exception e) {
+ LOG.error("Error creating bookie zookeeper client with {} for
bookie.", bookieZkConnect, e);
Review comment:
yeah, done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]