Using Confluent Platform systemd Service Unit Files¶
You can use Confluent Platform systemd service unit files to configure automatic startup and monitoring of services during system boot. These files are analogous to init scripts or startup scripts and they provide a standardized method for automatically starting Confluent Platform server components in the correct order on startup.
The systemd service unit files are optimized for staging and production deployments on Linux-based systems.
Table of Contents
- Control Center (
- Kafka (
- Kafka Connect (
- Kafka REST Proxy (
- KSQL Server (
- Schema-Registry (
- ZooKeeper (
Each component runs under its own user and a common
confluent group that are set up during package installation. This
configuration ensures proper security separation between components that are running on the same system. The usernames are
cp- followed by the component name. For example,
For components with persistent storage, such as Kafka and Confluent Control Center, the default component configuration file points to component-specific
/var/lib/<component>. For example, Kafka points to
/var/lib/kafka and ZooKeeper points to
This is an enhancement from previous Confluent Platform versions (where the default data directories were non-persistent (
to cater to staging and production deployments. For development use and throw-away clusters, see the installation_archive.
Enabling Automatic Startup During Boot¶
During installation, a component service is not enabled for automatic start on boot by default. To enable startup on boot, but not immediately, run this command.
sudo systemctl enable confluent-<component>
For example, you can enable the Kafka REST service with the command:
sudo systemctl enable confluent-kafka-rest
Starting Service Immediately¶
To start the service now, run this command:
sudo systemctl start confluent-<component>
This command will return immediately, although the service has not been started. The actual starting of the service is performed in the background by the systemd daemon.
Checking Service Status¶
To check the status of a service, run this command:
systemctl status confluent-<component>
Look for the
Active: line, which should say
Stopping a Service¶
To stop a service, run this command:
sudo systemctl stop confluent-<component>
Disabling a Service¶
To disable a service to prevent it from being automatically started on boot, run this command:
sudo systemctl disable confluent-<component>
Log files are located in component-specific directories
/var/log/confluent/. For example, Schema Registry logs are
The standard output of services is written to the log journal of a service. You can read the log journal with this command:
sudo journalctl -u confluent-<component>
Following the Log¶
To follow the log in real-time, run this command:
sudo journalctl -f -u confluent-<component>
Modifying Service Unit Configuration Settings¶
To make changes to the service unit configuration settings, you should append configuration settings that overwrite previous defaults, rather than change existing configuration lines. This assures that the base service unit files can be upgraded cleanly.
The systemd component configuration settings are minimal and only control how the component is started, run, and stopped. The
component configuration is managed through its existing
/etc/<component>/<component>.properties configuration file, for example
/etc/kafka/server.properties for the Kafka broker.
Modifying the Systemd Component Configuration¶
To modify the configuration settings for a service using the systemd builtin configuration editor, follow these steps:
View the current systemd component configuration:
systemctl cat confluent-<component>
Run the edit command:
sudo systemctl edit confluent-<component>
Optional: Inspect the result.
systemctl cat confluent-<component>
Reload systemd configuration and restart the component.
sudo systemctl reload sudo systemctl restart confluent-<component>
To reconfigure the Confluent Platform component, refer to the component documentation and its configuration file. The configuration files
are located in
<path-to-confluent>/etc/<component>/<component>.properties. After reconfiguring the component, restart
it with the following command to have the changes take affect:
sudo systemctl restart confluent-<component>
- For more information about systemd, see https://www.freedesktop.org/wiki/Software/systemd/.
- To see a working example of the systemd unit files in combination with Ansible, see the Confluent Platform Ansible playbook (No Confluent support, community support only).