Snap commands¶
Charmed Apache Kafka uses the charmed-kafka snap to install and operate the underlying Apache Kafka workload. These charms also wrap the upstream Apache Kafka Bash scripts bundled by upstream, as well as additional extra components selected for the charm to operate and manage, for example LinkedIn’s Cruise Control for Apache Kafka.
Snap commands and apps are used to ensure that the underlying executables are always ran with the correct environment settings (configuration files, logging files, etc).
Below is a reference table for the mapping between snap commands and apps with their associated
executable. Unless otherwise noted, commands are invoked through bin-wrapper.bash,
which sets default logging options before running the target script. Exceptions are noted
in the table: the three commands that start long-running services
(daemon, cruise-control, connect-distributed) use a dedicated wrapper, and keytool
has no wrapper at all. See Wrapper scripts for details.
Snap Command |
Executable |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
All of these commands can also be listed with:
snap info charmed-kafka
Wrapper scripts¶
There are two kinds of wrapper scripts:
bin-wrapper.bash— used by most commands. It only sets default logging options before running the target script.start-wrapper.bash/connect-wrapper.bash— used bydaemon,cruise-controlandconnect-distributedto start their respective long-running services. In addition to setting logging options, these drop root privileges to the confined_daemon_user (viasetpriv) before starting the service.
keytool is the only command with no wrapper — it invokes the JVM keytool binary directly.
Both wrapper types set the KAFKA_LOG4J_OPTS and KAFKA_JMX_OPTS environment variables
only if they are not already set, and point them at snap-specific paths, for example
${SNAP_DATA}/etc/kafka/log4j2.yaml. This env-var-based override pattern is inherited from upstream
Apache Kafka’s own bin/kafka-run-class.sh;
see the Configuration and
Monitoring
documentation for details on KAFKA_LOG4J_OPTS, KAFKA_JMX_OPTS, JMX_PORT and related variables.
The charmed.kafka.log.level property injected into KAFKA_LOG4J_OPTS is specific to the
charmed-kafka snap’s own log4j2.yaml template, and is not an upstream Apache Kafka property.