Skip to content

Commit

Permalink
fix(cli/deploy): override "controller.quorum.bootstrap.servers"
Browse files Browse the repository at this point in the history
Signed-off-by: Ning Yu <[email protected]>
  • Loading branch information
Chillax-0v0 authored and superhx committed Jan 3, 2025
1 parent dc36423 commit 552fb77
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ private static void appendCommonConfigsOverride(StringBuilder sb, ClusterTopolog
sb.append("--override cluster.id=").append(topo.getGlobal().getClusterId()).append(" ");
sb.append("--override node.id=").append(node.getNodeId()).append(" ");
sb.append("--override controller.quorum.voters=").append(getQuorumVoters(topo)).append(" ");
sb.append("--override controller.quorum.bootstrap.servers=").append(getBootstrapServers(topo)).append(" ");
sb.append("--override advertised.listeners=").append("PLAINTEXT://").append(node.getHost()).append(":9092").append(" ");
}

Expand All @@ -181,4 +182,14 @@ private static String getQuorumVoters(ClusterTopology topo) {
.map(node -> node.getNodeId() + "@" + node.getHost() + ":9093")
.collect(Collectors.joining(","));
}

private static String getBootstrapServers(ClusterTopology topo) {
List<Node> nodes = topo.getControllers();
if (!(nodes.size() == 1 || nodes.size() == 3)) {
throw new IllegalArgumentException("Only support 1 or 3 controllers");
}
return nodes.stream()
.map(node -> node.getHost() + ":9093")
.collect(Collectors.joining(","));
}
}

0 comments on commit 552fb77

Please sign in to comment.