Skip to main content
This document explains the data auto-rebalance testing for the AutoMQ cluster using the Kafka CLI tool. The Kafka CLI tool is executed through the Docker image provided by AutoMQ.
  1. Create a topic with multiple partitions and manually reassign partitions to specific nodes to induce an imbalance in partition distribution.
  2. Subsequently, send a balanced load to all partitions and observe if the partitions automatically reassign between different brokers.
This automatic data balancing is a fundamental feature of AutoMQ, ensuring automatic equitable distribution of data across the cluster. By monitoring the distribution of partitions and the load on brokers, you can verify whether the automatic partition balancing functions as expected.

Prerequisites

Before conducting automatic partition data rebalance tests, the following conditions must be met: Complete the installation and deployment of the AutoMQ cluster, you can refer to the following methods for installing and deploying AutoMQ:
If deploying the cluster via Deploy Multi-Nodes Cluster on Linux▸ or Deploy Multi-Nodes Cluster on Kubernetes▸, be sure to set autobalancer.controller.enable to true when starting the Controller to activate automatic data rebalancing.
Additionally, the host running the test program needs to meet the following criteria:
  • Linux/Mac/Windows Subsystem for Linux
  • Docker

Experience: Continuous Data Rebalance

If the previous AutoMQ cluster was deployed by following Deploy Multi-Nodes Test Cluster on Docker▸, then the obtained cluster Bootstrap address will be similar to “server1:9092,server2:9092,server3:9092”, and the AutoMQ cluster will be located within the “automq_net” Docker network.
Please substitute the bootstrap-server address below with the actual cluster address as per the deployment configuration.

Create Topic

View Partition Distribution

Manually Reassign Partitions

To facilitate the observation of continuous data rebalancing, we manually reassign partitions to node2.
  1. Create a plan for partition reassignment.
  1. Implement the partition reassignment plan.
  1. After the manual reassignment, view the partition distribution as follows:

Start the Producer.

Start the Consumer.

Rechecking Partition Distribution

After some time, you’ll notice the producer generating the following logs.
After waiting a few seconds, production will resume normal operations. Check the partition status again afterward.
It has been observed that because we reassigned all partitions to node2, all messages are being sent to node2 during production, creating a local hotspot on node2 and triggering AutoMQ’s Self-Balancing. AutoMQ reassigns partitions to achieve a balanced state across the nodes.