Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Status

Current stateUnder DiscussionAccepted

Discussion thread: https://lists.apache.org/thread/mwcljxdnyobthsszy4n2qr2tqcf9cxcf

...

The command line for stopping Kafka nodes will include a new optional parameter pair of optional and mutually exclusive parameters "[--process-role]" OR "[--required-config <name=value>node-id]" to  to support identifying a set of processes or a specific process to stop based on the contents of the node's configuration file.

...

The new script will accept an optional parameter " [--requiredprocess-config <namerole=value>value]", with name indicating any fields in the configuration file, to indicate that the script should only kill Kafka processes that are running with that value for the config fieldthe value indicating whether to kill Kafka broker processes or controller processes.

OR

The new script will accept an optional parameter [--node-id=value], with the value indicating the specific process, identified by its node id, that the user wishes to kill.

Example 1: the new command to kill all the broker processes will look like:

Code Block
./bin/kafka-server-stop.sh --required-config process.rolesprocess-role=broker

Example 2: the command to kill the process with node ID = 1 will look like:

Code Block
./bin/kafka-server-stop.sh --required-config node.id=1node-id=1

If both parameters are provided, the value for node-id parameter will take precedence, i.e, the process with node id specified will be killed, no matter what's the process role provided. Also, a log message will be shown to indicate that precedence. 

When neither a "process-role" nor a "node-id" field is When a "required-config" field is not provided, the behavior remains unchanged -- all Kafka processes are stopped.

...

I'm changing the "kafka-server-stop.sh" file to accept an optional field, required-config either "process-role" or "node-id". When the user specify a "name"(a specific field in the configuration file)specifies a process role or a node id, I will retrieve the absolute path to the configuration file, and search for the value of that field. If the value retrieved from the configuration file matches the input, that process will be killed, otherwise it will be skipped.

NOTE: If users want to use the feature, they have to provide an absolute path to the configuration file when starting a Kafka controller/broker process. 

Compatibility, Deprecation, and Migration Plan

Existing users won't need to change any behavior if they want to continue killing both controller and broker processes. Otherwise, if they want to kill only the broker/controller, or an individual broker/controller, they'll need to specify a "requiredprocess-configrole" field with "<name = value>" or a "node-id" field in the script.

Test Plan

The change can be tested through command line. 

Rejected Alternatives

One rejected alternatives is using an optional argument "[--required-config <name = value>]" to allow users to stop Kafka processes with any arbitrary name = value based on the node's configuration file. This argument gives the users freedom to choose any field in the configuration file to indicate the process they want to kill. However, upon discussion, we think this approach based on configs is a bit too open-ended and not very user friendly. Therefore, we decided to simply provide flags for the things a user may care about the most, i.e, two specific and mutually exclusive parameters process-role  and node-id . We agree that it is more user-friendly than the --required-config  argument, and it comes at the possible expense of generality.