DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
Status
Current state: "Under Discussion"
Discussion thread: here
JIRA: https://issues.apache.org/jira/browse/KAFKA-18775
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Motivation
Currently, when using MetadataQuorumCommand to add a controller, users must provide a controller.properties configuration file. This file is required for the command to retrieve the metadata local path and endpoints needed to add voters. However, this approach has several limitations:
- Limited Accessibility: The node executing the tool must have direct access to the metadata path of the node being added or removed. This restricts the ability to use node A to manage node B, as node A may not have access to the metadata folder on node B.
Dependency on Node Configuration: The tool requires access to the configuration of the node being managed.
However, the essential information for these operations – the "directory UUID" and the "endpoints" – can be obtained through the Admin API.
- The
Admin#describeMetadataQuorummethod can provide the directory UUID. The
Admin#describeConfigsmethod, utilizing thebootstrap.controlleraddress, can be used to retrieve the necessary endpoints.
By leveraging these APIs, we can simplify the process of adding/removing voters, allowing the command to be executed without direct access to the target node's metadata directory.
Public Interfaces
CLI
The kafka-metadata-quorum.sh tool introduces a new option —-controller-id for the add-controller subcommand.
Adding a controller
This can only be done with bootstrap controller option since we can‘t use bootstrap.server in Admin#describeConfigs to get controller configs.
bin/kafka-metadata-quorum.sh --bootstrap-controller localhost:9093 add-controller --controller-id <id>
Removing a controller
For removing a controller, the —-controller_directory_id option is no longer required.
bin/kafka-metadata-quorum.sh --bootstrap-server localhost:9092 remove-controller --controller-id <id>
bin/kafka-metadata-quorum.sh --bootstrap-controller localhost:9093 remove-controller --controller-id <id>
Proposed Changes
add-controller changes
Add a new option —-controller-id to add-controller subcommand.
addControllerParser
.addArgument("--controller-id", "-i")
.help("The id of the controller to add. This option should be used with bootstrap controller.")
.type(Integer.class)
.action(Arguments.store());
When using
--controller-idwith--bootstrap-controller, the MetadataQuorumCommand will:Retrieve the directory UUID via
Admin#describeMetadataQuorum.Fetch the required endpoints via
Admin#describeConfigsmethod (usingbootstrap.controller)
If
—-command-configis provided, fallback to the existing behavior, and—-controller-idoption will be ignored.If neither command-config nor controller-id with bootstrap-controller is provided, an exception will be thrown:
throw new TerseException("You must supply the configuration file of the controller you are adding when using add-controller, or either using controller id with bootstrap controller option to add a controller.");
remove-controller changes
diff --git a/tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java b/tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java
index dba7951aa4..f3bdbbeffa 100644
--- a/tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java
+++ b/tools/src/main/java/org/apache/kafka/tools/MetadataQuorumCommand.java
@@ -471,7 +471,6 @@ public class MetadataQuorumCommand {
removeControllerParser
.addArgument("--controller-directory-id", "-d")
.help("The directory ID of the controller to remove.")
- .required(true)
.action(Arguments.store());
The
—-controller_directory-idis no longer required. We can useAdmin#describeMetadataQuorummethod to get the controller directory UUID.If
—-controller_directory-idis explicitly provided, it will be used directly, andAdmin#describeMetadataQuorumwill not be called.
Compatibility, Deprecation, and Migration Plan
This change should be backward compatible:
The
—-command-configoption remains available inadd-controller.The
--controller-directory-idoption inremove-controlleris now optional but still supported.
Test Plan
New test cases will be added to MetadataQuorumCommandTest.java to validate:
Adding a controller with
--controller-id.Removing a controller without explicitly providing
--controller-directory-id.
Rejected Alternatives
- Deprecate
—-command-configoption inadd-controllerand--controller-directory-idoption inremove-controller.The main reason not to deprecate these two parameters is that they were only just introduced in 4.0, so deprecating them in a 4.x release feels a bit too soon.