Charmed Kafka
- Canonical
- Databases
Channel | Revision | Published | Runs on |
---|---|---|---|
3/stable | 195 | 10 Dec 2024 | |
3/candidate | 195 | 04 Dec 2024 | |
3/beta | 195 | 09 Dec 2024 | |
3/edge | 193 | 26 Nov 2024 |
juju deploy kafka --channel 3/stable
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
charms.kafka.v0.kafka_snap
-
- Last updated 20 Aug 2022
- Revision Library version 0.4
KafkaSnap class and methods
KafkaSnap
provides a collection of common functions for managing the Kafka Snap and
running bin commands common to both the Kafka and ZooKeeper charms.
The Kafka Snap tracks the upstream binaries released by
The Apache Software Foundation that comes with Apache Kafka.
Currently the snap channel is hard-coded to rock/edge
.
Exposed methods includes snap installation, starting/restarting the snap service, and running bin commands exposed in the snap services
Example usage for KafkaSnap
:
class KafkaCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.snap = KafkaSnap()
self.framework.observe(getattr(self.on, "start"), self._on_start)
def _on_start(self, event):
self.snap.install()
self.snap.start_snap_service(snap_service="kafka")
Index
class KafkaSnap
Description
Wrapper for performing common operations specific to the Kafka Snap. None
Methods
KafkaSnap. __init__( self )
KafkaSnap. install( self )
Loads the Kafka snap from LP, returning a StatusBase for the Charm to set.
Returns
True if successfully installed. False otherwise.
KafkaSnap. start_snap_service( self , snap_service: str )
Starts snap service process.
Arguments
The desired service to run on the unit
kafka
or zookeeper
Returns
True if service successfully starts. False otherwise.
KafkaSnap. stop_snap_service( self , snap_service: str )
Stops snap service process.
Arguments
The desired service to stop on the unit
kafka
or zookeeper
Returns
True if service successfully stops. False otherwise.
KafkaSnap. restart_snap_service( self , snap_service: str )
Restarts snap service process.
Arguments
The desired service to run on the unit
kafka
or zookeeper
Returns
True if service successfully restarts. False otherwise.
KafkaSnap. run_bin_command( bin_keyword: str , bin_args , opts )
Runs kafka bin command with desired args.
Arguments
the kafka shell script to run
e.g configs
, topics
etc
the shell command args
the desired KAFKA_OPTS
env var values for the command
Returns
String of kafka bin command output