이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 17. Using Cruise Control to reassign partitions on JBOD disks


If you are using JBOD storage and have Cruise Control installed with Strimzi, you can reassign partitions and move data between the JBOD disks used for storage on the same broker. This capability also allows you to remove JBOD disks without data loss.

Use the Kafka kafka-log-dirs.sh tool to check information about Kafka topic partitions and their location on brokers before and after moving them.

Make requests to the remove_disks endpoint of the Cruise Control REST API to demote a disk in the cluster and reassign its partitions to other disk volumes.

Prerequisites

In this procedure, we use a broker configured with three JBOD volumes and a topic replication factor of three.

Example broker configuration with JBOD storage

node.id=1
process.roles=broker
default.replication.factor = 3
log.dirs = /var/lib/kafka/data-0,/var/lib/kafka/data-1,/var/lib/kafka/data-2
# ...
Copy to Clipboard Toggle word wrap

In the procedure, we reassign partitions for broker 1 from volume 0 to volumes 1 and 2.

Procedure

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

    cd ./cruise-control/
    ./kafka-cruise-control-start.sh config/cruisecontrol.properties <port_number>
    Copy to Clipboard Toggle word wrap
  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'
    Copy to Clipboard Toggle word wrap
  3. (Optional) Check the partition replica data on the broker by using the Kafka kafka-log-dirs.sh tool:

    kafka-log-dirs.sh --describe --bootstrap-server my-cluster-kafka-bootstrap:9092 --broker-list 1 --topic-list my-topic
    Copy to Clipboard Toggle word wrap

    The tool returns topic information for each log directory. In this example, we are restricting the information to my-topic to show the steps against a single topic. The JBOD volumes used for log directories are mounted at /var/lib/kafka/<volume_id>.

    Example output data for each log directory

    {
      "brokers": [
        {
          "broker": 1, 
    1
    
          "logDirs": [
            {
              "partitions": [  
    2
    
                {
                  "partition": "my-topic-0",
                  "size": 0,
                  "offsetLag": 0,
                  "isFuture": false
                }
              ],
              "error": null, 
    3
    
              "logDir": "/var/lib/kafka/data-0" 
    4
    
            },
            {
              "partitions": [
                {
                  "partition": "my-topic-1",
                  "size": 0,
                  "offsetLag": 0,
                  "isFuture": false
                }
              ],
              "error": null,
              "logDir": "/var/lib/kafka/data-1"
            },
            {
              "partitions": [
                {
                  "partition": "my-topic-2",
                  "size": 0,
                  "offsetLag": 0,
                  "isFuture": false
                }
              ],
              "error": null,
              "logDir": "/var/lib/kafka/data-2"
            }
          ]
        }
      ]
    }
    Copy to Clipboard Toggle word wrap

    1
    The broker ID.
    2
    Partition details: name, size, offset lag. The (isFuture) property indicates that the partition is moving between log directories when showing as true.
    3
    If error is not null, there is an issue with the disk hosting the log directory.
    4
    The path and name of the log directory.
  4. Remove the volume from the node:

    curl -v -X POST 'http://<cc_host>:<cc_port>/kafkacruisecontrol/remove_disks?dryrun=false&brokerid_and_logdirs=1-/var/lib/kafka/data-0'
    Copy to Clipboard Toggle word wrap

    The command specifies the broker ID and log directory for the volume being removed. If successful, partitions are reassigned from volume 0 on broker 1.

    Note

    If required, you can perform a dry run of this operation before applying the changes.

  5. Use the Kafka kafka-log-dirs.sh tool again to verify volume removal and data movement.

    In this example, volume 0 has been removed and my-topic-0 partition reassigned to /var/lib/kafka/data-1.

    Example output data following reassignment of partitions

    {
      "brokers": [
        {
          "broker": 1,
          "logDirs": [
            {
              "partitions": [
                {
                  "partition": "my-topic-0",
                  "size": 0,
                  "offsetLag": 0,
                  "isFuture": false
                },
                {
                  "partition": "my-topic-1",
                  "size": 0,
                  "offsetLag": 0,
                  "isFuture": false
                }
              ],
              "error": null,
              "logDir": "/var/lib/kafka/data-1"
            },
            {
              "partitions": [
                {
                  "partition": "my-topic-2",
                  "size": 0,
                  "offsetLag": 0,
                  "isFuture": false
                }
              ],
              "error": null,
              "logDir": "/var/lib/kafka/data-2"
            }
          ]
        }
      ]
    }
    Copy to Clipboard Toggle word wrap

맨 위로 이동
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2025 Red Hat