11.2 Adding Partitions to an Existing Topic

The topics in OCNADD must be created with the necessary partitions for the supported MPS during the deployment. In case the traffic load increases beyond the supported MPS, there may be the need to increase the number of partitions in the existing topics. This section describes the procedure to increase the number of partitions in the corresponding topic.

Caution:

The number of partitions cannot be decreased using this procedure. In the case of partition reduction is required the topics needs to be recreated with the desired number of partition, in such case the complete data loss of the concerned topic is anticipated.

To add partitions to an existing topic:
  1. Login to the bastion host.
  2. Enter the Kafka broker POD using the following command:
    "kubectl exec -it kafka-broker-0 -n <namespace> --  bash"

    Example:

    kubectl exec -it kafka-broker-0 -n ocnadd-deploy --bash
  3. Inside the POD change directory to "/ocnadd/kafka/bin"
  4. Run the following command:
    "unset JMX_PORT"
  5. Describe the corresponding topic using the following command:
    ./kafka-topics.sh  --topic <topic_name>--describe  --bootstrap-server
        kafka-broker-0:9092

    Example:

    ./kafka-topics.sh --topic SCP --describe --bootstrap-server  kafka-broker-0:9092

    The command lists the topic details such as number of partitions, replication factor, retentionMs etc.

  6. Add partitions in the topic using the following command:
    /kafka-topics.sh --topic <topic_name> --alter --bootstrap-server kafka-broker-0:9092 --partitions
            <partition_count>
  7. Verify that the partitions have been added to the topic using the following command:
    ./kafka-topics.sh --topic <topic_name> --describe --bootstrap-server kafka-broker-0:9092 

    Example:

    ./kafka-topics.sh --topic SCP --describe --bootstrap-server kafka-broker-0:9092
  8. Exit from the Kafka Broker POD (container).