Versions Compared

Key

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

...

However in KRaft mode, they can't stop the KRaft controllers independently from the Kafka brokers because there is just a single script that doesn't distinguish between the two processes and signals both of them. We need to provide a way for users to kill either controllers or brokers, and more specifically, individual controller or broker when there are multiple of them.

Public Interfaces

The command line for stopping Kafka nodes will include a new optional parameter ("required-config") to support (1) identifying a specific process (2) identifying a specific node ID to stop based on the contents of the node's configuration file (specifically, the process.roles value).

Instead of simply running 

...

The new script will accept an optional parameter "[--required-config <name=value>]", and <name> can take either "process.roles <value>" " or "node.id", to indicate that the script should only kill Kafka processes that are running with that value for the config. For example,
Example 1: the new command to kill all the broker only processes will look like:

Code Block
./bin/kafka-server-stop.sh --required-config process.roles broker=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=1

When a "process.rolesrequired-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, process role required-config. When the user specify a process role / node ID, I will retrieve the absolute path to the configuration file, and search for the value of "process.roles / node.id". If the "process.roles" value retrieved from the configuration file matches the process role the user providedinput, that process will be killed, otherwise it will be skipped.

...

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 either only the broker/controller, or an individual broker/controller, they'll need to specify a "process.roles" field "required-config" field with "<process-roles = value>" or "<node.id = value>" in the script.

Test Plan

The change can be tested through command line. 

...