Chapter 14. Using Cruise Control to modify topic replication factor


Make requests to the /topic_configuration endpoint of the Cruise Control REST API to modify topic configurations, including the replication factor.

Prerequisites

Procedure

  1. Start the Cruise Control server. The server starts on port 9092 by default; optionally, specify a different port.

    cd /opt/cruise-control/
    ./kafka-cruise-control-start.sh config/cruisecontrol.properties <port_number>
  2. To verify that Cruise Control is running, send a GET request to the /state endpoint of the Cruise Control server:

    curl -X GET 'http://<cc_host>:<cc_port>/kafkacruisecontrol/state'
  3. Run the bin/kafka-topics.sh command with the --describe option and to check the current replication factor of the target topic:

    /opt/kafka/bin/kafka-topics.sh \
      --bootstrap-server localhost:9092 \
      --topic <topic_name> \
      --describe
  4. Update the replication factor for the topic:

    curl -X POST 'http://<cc_host>:<cc_port>/kafkacruisecontrol/topic_configuration?topic=<topic_name>&replication_factor=<new_replication_factor>&dryrun=false'

    For example, curl -X POST 'localhost:9090/kafkacruisecontrol/topic_configuration?topic=topic1&replication_factor=3&dryrun=false'.

  5. Run the bin/kafka-topics.sh command with the --describe option, as before, to see the results of the change to the topic.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.