banner



How To Clean All Stand Alone Kafka

This blog mail service is the quaternary in a four-part series that discusses a few new Confluent Command Middle features that are introduced with Confluent Platform 6.2.0. Information technology focuses on removing residue data via a new cleanup script that helps you remove quondam Control Center instances easily. The series highlights the post-obit new features that make managing Apache Kafka® clusters via Control Center an even smoother feel:

  • Create Kafka letters (with key and value) direct from within Control Center
  • Export Kafka messages in JSON or CSV format via Control Middle
  • Improved topic inspection by showing the last fourth dimension that a bulletin was produced to a topic
  • Remove residuum data from quondam Control Center instances with a cleanup script

If you are non too familiar with Control Center, yous can always refer to the Control Centre overview start. Having a running Control Heart instance at hand helps y'all explore the features discussed in this blog series meliorate.


Now that you are ready, permit'south delve into the fourth feature here in office four: removing balance data with the Control Middle Cleanup script.

  • What "removing rest data with cleanup script" is: Understand when and why you would use this cleanup script
  • How to run the cleanup script: Find out how to run the script and the data that would exist cleaned up
  • Benefits of the cleanup script: Learn about the differences between the cleanup script and the reset script and why you would utilise the cleanup script

What "removing remainder information with cleanup script" is

With each version upgrade or ID update (explained more than later), Control Centre creates a new ready of internal topics that correspond to the new Control Centre instance. Consequently, after a Control Heart upgrade/update, you may notice topics from former instances are left behind, cluttering the "Topics" overview folio equally shown below. These old topics are not used past the new Control Center case, but they continue to take up disk space. Control Centre does non automatically delete the one-time topics in order to avert accidental removal of wanted information. Unfortunately, transmission deletion of the old topics tin make the Control Center upgrade/update process cumbersome and error prone.

Version 6.2.0 introduces a new cleanup script bin/command-middle-cleanup that allows yous to interactively delete the onetime instances' rest—topics and local directories—easier and faster when you upgrade/update Command Middle. With this new script, y'all can delete the old instances' residue while the current instance of Control Heart is running.

Topic residue from the Control Center upgrade of version 5.4.1 to 6.2.0
The case above shows the topic residuum from the Command Center upgrade of version 5.iv.1 to half dozen.2.0, where the old set of internal topics prefixed with _confluent-controlcenter-5-four-one-1 are left backside and coexist with the new set prefixed with _confluent-controlcenter-vi-ii-0-one.

The same issue occurs if you change the Command Centre unique identifier using confluent.controlcenter.id in your properties file. Control Heart unique identifiers are useful if you lot want multiple instances of Control Center to coexist on the same server. All the same, if you decide to keep just one instance subsequently an identifier alter, you will meet the same data residue issues. For case, if you have Command Center version 6.2.0 and changed the ID from one to 2, and so the old fix of internal topics prefixed with _confluent-controlcenter-six-2-0-one are left backside and coexist with the new set prefixed with _confluent-controlcenter-vi-2-0-2.

How to run the cleanup script

Step i (of import): Have a Command Middle configuration file set

The cleanup script requires a Control Center properties file to found the initial connexion to the Kafka cluster and to decide what the current running Control Center instance is in order to avoid deleting its data. The cleanup script uses:

  • confluent.controlcenter.proper name to determine the name of the running instance
  • The package that you're running the script from to make up one's mind the version of the running instance
  • confluent.controlcenter.id to make up one's mind the unique identifier of the running example
  • confluent.controlcenter.data.dir to determine the directory that contains local information of Control Center instances


For example, the post-obit Control Center backdrop file etc/confluent-control-center/control-center.properties contains the post-obit:

############################# Server Basics ############################# bootstrap.servers=localhost:9092 zookeeper.connect=localhost:2181 ######################### Control Center Settings ######################### confluent.controlcenter.data.dir=/tmp/control-heart confluent.controlcenter.id=one # using default confluent.controlcenter.name, "_confluent-controlcenter"        

Therefore, running the cleanup script from package confluent-half-dozen.2.0, the script determines that the running instance is _confluent-controlcenter-6-2-0-1 (<running instance name>-<version>-<id>). Information technology also determines that the local data of all instances reside in /tmp/control-center.

Step ii: Run the cleanup script

Presume that simply the Control Center example divers in the properties file—_confluent-controlcenter-6-ii-0-1—is up and running.

Navigate to $CONFLUENT_HOME, run the script equally ./bin/command-centre-cleanup <props_file>, and you volition go the following prompt:

Tip:

$CONFLUENT_HOME is the environment variable for your Confluent Platform directory. Yous can ready it with export CONFLUENT_HOME=<path-to-confluent>, for instance, export CONFLUENT_HOME=~/Downloads/confluent-6.2.0.

./bin/control-center-cleanup etc/confluent-control-center/control-heart.properties ============================================================================ The cleanup script establish the post-obit case:  _confluent-controlcenter-six-2-0-1 Nosotros believe this COULD be the instance defined in your config file so it will not be prompted for cleanup.   Here are the instances discovered for cleanup:  _confluent-controlcenter-five-4-ane-one _confluent-controlcenter-v-four-i-2 Cleanup ALL of the instances above? [y/Northward]:        

The script avoids cleaning the running instance—_confluent-controlcenter-6-2-0-1—and discovers that in that location are two one-time Control Center instances from version 5.4.one available for cleanup, _confluent-controlcenter-5-iv-one-1 and _confluent-controlcenter-v-four-1-2.

You tin can type y to clean all of the onetime instances without intermissions or prompts.

You tin can type N to receive a prompt individual instance cleanup instead.

Step 3: Individual instance cleanup

Assuming N is used in the previous step, you volition receive the following prompt:

Exercise you lot want to cleanup _confluent-controlcenter-five-four-1-1 ? [y/N/dryRun]:

For each Command Center instance, you can type y to clean the instance'due south topics and the instance's local directories.

  • Case topics: Every internal topic that is prefixed with the instance proper noun. Refer to below for a few internal topics for instance name _confluent-controlcenter-5-iv-ane-1:
    _confluent-controlcenter-five-4-ane-1-AlertHistoryStore-changelog _confluent-controlcenter-5-4-i-1-MetricsAggregateStore-changelog _confluent-controlcenter-5-four-1-one-cluster-rekey _confluent-controlcenter-five-4-1-1-expected-group-consumption-rekey _confluent-controlcenter-5-iv-one-1-actual-group-consumption-rekey            
  • Instance local directories: <confluent.controlcenter.data.dir>/<instance id>/cp-command/<instance name> and <confluent.controlcenter.data.dir>/<instance id>/kafka-streams/<instance proper name>. Refer to the tabular array below for an example:
    /tmp/control-eye/1 cp-command/ _confluent-controlcenter-v-iv-1-one/
    kafka-streams/ _confluent-controlcenter-5-4-1-one/

You can type North to skip cleanup for the instance at hand.

You can blazon dryRun to come across what topics and local directories will be deleted without any actual impact. Later on dryRun, you will be prompted to make clean up the same instance over again with option [y/N/dryRun] until you either type y or N, deciding to clean or skip the example.

Step 4: Repeat until no more than instances are left for cleanup

If y'all would like to avert existence prompted to make clean each instance, type y in pace 2, Cleanup ALL of the instances higher up? [y/N].

Steps 1–4: A complete example

A majority of the logs are omitted beneath, except for high-level logs. Lines that start with # are comments added later and are not office of the original log.

./bin/control-center-cleanup etc/confluent-control-center/control-eye.properties ================================================================================ The cleanup script found the following case:  _confluent-controlcenter-six-2-0-i Nosotros believe this COULD exist the instance defined in your config file so it will not be prompted for cleanup.   Hither are the instances discovered for cleanup:  _confluent-controlcenter-5-4-1-1 _confluent-controlcenter-five-iv-ane-ii Cleanup ALL of the instances above? [y/N]: N   Do you want to cleanup _confluent-controlcenter-5-four-1-1 ? [y/N/dryRun]: dryRun ----Dry run displays the deportment which will be performed when running Streams Reset Tool---- Reset-offsets for input topics [_confluent-monitoring, _confluent-command, _confluent-metrics] Seek-to-end for intermediate topics [_confluent-controlcenter-5-four-1-1-cluster-rekey, _confluent-controlcenter-five-4-one-1-monitoring-bulletin-rekey-shop, _confluent-controlcenter-5-4-1-1-actual-group-consumption-rekey, _confluent-controlcenter-5-four-i-i-expected-group-consumption-rekey, _confluent-controlcenter-5-4-1-1-group-stream-extension-rekey, _confluent-controlcenter-5-4-one-1-monitoring-trigger-outcome-rekey, _confluent-controlcenter-5-4-1-one-MetricsAggregateStore-repartition, _confluent-controlcenter-5-4-one-1-metrics-trigger-measurement-rekey] Post-obit input topics offsets volition be reset to (for consumer group _confluent-controlcenter-5-four-ane-1) (...) Following intermediate topics offsets volition be reset to stop (for consumer grouping _confluent-controlcenter-5-4-1-i) (...) Deleting all internal/machine-created topics for application _confluent-controlcenter-v-four-1-ane (...) Deleting intermediate topics (for consumer group _confluent-controlcenter-v-iv-1-one) (...) Deleting local RocksDB data in /tmp/confluent/control-center/i Deleting /tmp/confluent/control-middle/ane/cp-command/_confluent-controlcenter-v-four-one-ane-command Deleting /tmp/confluent/control-center/i/kafka-streams/_confluent-controlcenter-5-iv-1-1 Done. Finished dryRun for _confluent-controlcenter-5-4-ane-i . Do yous desire to clean information technology up? [y/Due north/dryRun]: y # Logs omitted. Same steps every bit to a higher place: # 1. For input topics, reset offsets to specified position (default EARLIEST) ← from Kafka Streams Reset Tool # 2. For intermediate topics, seek offsets to the end, LATEST ← from Kafka Streams Reset Tool # 3. Delete internal/motorcar-created topics ← from Kafka Streams Reset Tool # 4. Delete intermediate topics # 5. Delete local RocksDB data in directories Do yous desire to cleanup _confluent-controlcenter-v-4-1-2 ? [y/Due north/dryRun]: y # Logs omitted. Same 5 steps as above. ================================================================================        

If yous run the cleanup script again, you will see that _confluent-controlcenter-5-4-1-ane and _confluent-controlcenter-5-4-1-2 were cleaned upward successfully and you won't be prompted once more.

./bin/control-center-cleanup etc/confluent-control-eye/control-center.properties ================================================================================ The cleanup script institute the following instance:  _confluent-controlcenter-half dozen-2-0-ane We believe this COULD exist the instance defined in your config file so it will not be prompted for cleanup.   The cleanup script found no instances for cleanup. ================================================================================        

Tip:

If y'all are curious and would like to larn a bit more, the cleanup script internally uses the Kafka Streams Application Reset Tool to reset offsets for input and intermediate topics and to delete internal/motorcar-created topics. Hence, you see logs like "Reset-offsets for input topics…" and "Seek-to-finish for intermediate topics…"

Advantages of the cleanup script

Historically, Control Eye has a reset script, bin/control-center-reset, which supports the cleanup of one instance at a fourth dimension without any guidance prompts: The script just deletes the instance defined in the provided properties file and does not automatically discover other instances. Therefore, in order to maintain a clean Control Center environment, it is recommended that you run the reset script upon each version upgrade or unique identifier update.

Before we dive into the benefits of the cleanup script, the following provides a flake more detail virtually the reset script.

How to run the reset script

Just similar the cleanup script, the reset script also requires a Control Center properties file. It is used to establish the initial connectedness to the Kafka cluster and to determine the Control Eye instance to delete (the reset script only deletes the instance defined in your properties file). New with version 6.2.0, dryRun flag is now supported for the reset script:

bin/control-centre-reset <props_file> [--dryRun]

With the dryRun flag, the script previews the topics and directories pertaining to the Control Heart example defined in your properties file, without actually deleting them.

Tip:

If you are running a reset script from an older Confluent Platform package, brand certain you have the correct target instance defined in your properties file—there's no trial run!

Local directories deleted earlier vs. afterward six.ii.0

It is important to annotation that prior to version 6.2.0, the reset script would clean local directories more than "drastically." It finds the unique identifier in the properties file, confluent.controlcenter.id, and deletes the entire ID directory, not but the directories of the target instance.

For example, if the unique identifier is 1, and you have two Control Center instances with ID i, _confluent-controlcenter-5-4-1-1 (target instance to delete) and _confluent-controlcenter-6-ii-0-1, then the entire ID directory /tmp/control-center/1 would be deleted, non just the directories of _confluent-controlcenter-v-4-1-ane (orange directories deleted):

Deleted directions shown deleted
This reset script result is fixed in version six.2.0, where just the target instance's directories are deleted:
Target instances directories deleted

Benefits of the cleanup script

To summarize, despite the subtle differences betwixt the two scripts, the reset script and the cleanup script are consummate opposites. The old can only delete the Control Center example divers in your Control Heart configuration file, while the latter can automatically discover and delete whatsoever instances except the one defined in your configuration file. To maintain a make clean environment, the reset script needs to be run each fourth dimension earlier yous start a new instance, while the cleanup script can run anytime (before or after a new case and even only periodically). The cleanup script too provides a handful of guidance prompts, giving you full control over which example(s) to delete.

There are a few benefits of the cleanup script that would make your Control Centre upgrade/update process less error prone and cumbersome:

Reduced ops burden: Clean upwardly multiple Control Center instances in one go

You are an operator and strive to maintain a make clean environs by but keeping the necessary Control Middle instances—you tin at present use the cleanup script to periodically delete all the unused instances in one become. No need to manually hunt downwards each Kafka topic or local data from sometime Control Center instances anymore.

Easier Control Center upgrades and config changes using only the latest Control Eye configuration file

Imagine you are an operator and just performed a Command Middle unique identifier update. With the reset script, you would need to change the properties file to target the instance that you want to delete and echo the process until all the sometime instances are deleted. Now with the cleanup script, y'all only need the latest properties file, which volition single out the running instance and delete the old ones.

Let'south say yous are an operator and but performed a Control Center version upgrade. With the reset script, in guild to delete an old instance, you would demand to run the script in the Confluent Platform package whose version matches the target instance. For example, to delete an instance of version 5.4.1, you lot need to run the script in Confluent Platform package five.iv.ane; running the reset script in Confluent Platform package v.four.two would delete the 5.4.2 instance, not the target five.4.1 instance. Now with the cleanup script, y'all can run the script in any Confluent Platform parcel that provides it, and it volition automatically discover onetime instances to delete. No demand to friction match the parcel version with the target instance!

Safety prompts to forbid operator mistakes

For operators who want to make sure they do not accidentally delete the wrong Control Center instances, the cleanup script provides guidance prompts to avoid accidental deletion.

Summary

In summary, removing residuum data with the Control Middle cleanup script allows y'all to maintain a make clean environment by removing data from unused Command Middle instances in one run, making the Control Center upgrade/update process more than efficient and less error decumbent.

Become Started

To learn near other new features of Control Center 6.2.0, cheque out the remaining blog posts in this series:

  • Part i: How to Better Manage Apache Kafka by Creating Kafka Messages from inside Command Eye
  • Part 2: How to Meliorate Manage Apache Kafka by Exporting Kafka Messages via Control Center
  • Part 3: How to Better Manage Apache Kafka with Improved Topic Inspection via Concluding-Produced Timestamp

Rinka Yoshida joined Confluent in 2020 equally a backend developer for Confluent Control Center and currently works on projects that identify and abound users' journeys with Confluent Platform. She earned a bachelor's degree in reckoner science from the University of California, San Diego.

Source: https://www.confluent.io/blog/better-kafka-management-with-confluent-control-center-part-4/

Posted by: goldmanvizing.blogspot.com

0 Response to "How To Clean All Stand Alone Kafka"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel