Changing the Broker Storage Directory

Scenario

This section applies to MRS 3.x or later.

When a broker storage directory is added, the system administrator needs to change the broker storage directory on FusionInsight Manager, to ensure that the Kafka can work properly. The new topic partition will be generated in the directory that has fewest partitions. Changing the ZooKeeper storage directory includes the following scenarios:

Because Kafka does not detect disk capacity, ensure that the disk quantity and capacity configured for each Broker instance are the same.

Impact on the System

Prerequisites

Procedure

Changing the storage directory of the Kafka role

  1. Log in as user root to each node on which the Kafka service is installed, and perform the following operations:

    1. Create a target directory.

      For example, to create the target directory ${BIGDATA_DATA_HOME}/kafka/data2, run the following command:

      mkdir ${BIGDATA_DATA_HOME}/kafka/data2

    2. Mount the directory to the new disk. For example, mount ${BIGDATA_DATA_HOME}/kafka/data2 to the new disk.
    3. Modify permissions on the new directory.

      For example, to modify permissions on the ${BIGDATA_DATA_HOME}/kafka/data2 directory, run the following commands:

      chmod 700 ${BIGDATA_DATA_HOME}/kafka/data2 -R and chown omm:wheel ${BIGDATA_DATA_HOME}/kafka/data2 -R

  2. Log in to FusionInsight Manager for clusters of MRS 3.x or later and choose Cluster > Services > Kafka > Configurations.
  3. Add a new directory to the end of the default value of log.dirs.

    Enter log.dirs in the search box and add the new directory to the end of the default value of the log.dirs configuration item. Use commas (,) to separate multiple directories. For example:

    ${BIGDATA_DATA_HOME}/kafka/data1/kafka-logs,${BIGDATA_DATA_HOME}/kafka/data2/kafka-logs

  4. Click Save, and then click OK. When Operation succeeded is displayed, click Finish.
  5. Choose Cluster > Services > Kafka. In the upper right corner, choose More > Restart Service to restart the Kafka service.

Changing the storage directory of a single Kafka instance

  1. Log in to the Broker node as user root and perform the following operations:

    1. Create a target directory.

      For example, to create the target directory ${BIGDATA_DATA_HOME}/kafka/data2, run the following command:

      mkdir ${BIGDATA_DATA_HOME}/kafka/data2

    2. Mount the directory to the new disk. For example, mount ${BIGDATA_DATA_HOME}/kafka/data2 to the new disk.
    3. Modify permissions on the new directory.

      For example, to modify permissions on the ${BIGDATA_DATA_HOME}/kafka/data2 directory, run the following commands:

      chmod 700 ${BIGDATA_DATA_HOME}/kafka/data2 -R and chown omm:wheel ${BIGDATA_DATA_HOME}/kafka/data2 -R

  2. Log in to FusionInsight Manager for MRS 3.x or later, and choose Cluster > Services > Kafka > Instance.
  3. Click the specified broker instance and switch to Instance Configurations.

    Enter log.dirs in the search box and add the new directory to the end of the default value of the log.dirs configuration item. Use commas (,) to separate multiple directories, for example, ${BIGDATA_DATA_HOME}/kafka/data1/kafka-logs,${BIGDATA_DATA_HOME}/kafka/data2/kafka-logs.

  4. Click Save, and then click OK. A message is displayed, indicating that the operation is successful. Click Finish.
  5. On the Broker instance page, choose More > Restart Instance to restart the Broker instance.