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.
- Login to the bastion host.
- 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 - Inside the POD change directory to
"/ocnadd/kafka/bin" - Run the following
command:
"unset JMX_PORT" - Describe the corresponding topic using the following
command:
./kafka-topics.sh --topic <topic_name>--describe --bootstrap-server kafka-broker-0:9092Example:
./kafka-topics.sh --topic SCP --describe --bootstrap-server kafka-broker-0:9092The command lists the topic details such as number of partitions, replication factor, retentionMs etc.
- 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> - 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:9092Example:
./kafka-topics.sh --topic SCP --describe --bootstrap-server kafka-broker-0:9092 - Exit from the Kafka Broker POD (container).