Skip to content

Unix job control for Kafka processes

The standard command for starting a Kafka broker is kafka-server-start.sh, which accepts the server configuration file (typically server.properties) as an argument.^[600-developer-big-data-kafka-kafka-01.md]

Because the startup process occupies the terminal, Unix job control commands can be used to manage it.^[600-developer-big-data-kafka-kafka-01.md]

Execution workflow

To start the broker, run the server script.^[600-developer-big-data-kafka-kafka-01.md]

bin/kafka-server-start.sh config/server.properties

Once the process is running, you can manage it directly in the shell using the following steps^[600-developer-big-data-kafka-kafka-01.md]:

  1. Suspend the process: Press Ctrl + Z to pause the foreground process.
  2. Resume in background: Execute bg to resume the suspended process in the background.
  3. Verify status: Run jobs -l to list active background jobs.
  4. Bring to foreground: If needed, use fg %1 (where 1 is the job number) to bring the specific background job back to the foreground.

Process termination

To gracefully shut down the Kafka broker, use the dedicated stop script provided by the Kafka binaries.^[600-developer-big-data-kafka-kafka-01.md]

bin/kafka-server-stop.sh
  • [[Kafka]]
  • [[Unix job control]]
  • [[Process management]]

Sources

^[600-developer-big-data-kafka-kafka-01.md]