You can use create standalone java program to achieve the same , i.e increase and decrease the partition and replication using AdminUtils.
import org.I0Itec.zkclient.ZkClient;
import kafka.admin.AdminUtils;
import kafka.utils.ZKStringSerializer$;
import kafka.utils.ZkUtils;
import scala.collection.Seq;
import scala.collection.Map;
public PartitionCreator(String zkhost, String topicName, int partitions, int replifactor) {
ZkClient zkClient = new ZkClient(zkhost, 30000, 30000, ZKStringSerializer$.MODULE$);
zkUtils = ZkUtils.apply(zkClient, false);
this.topicName = topicName;
this.partitions = partitions;
this.replifactor = replifactor;
}
public void createPartion() {
AdminUtils.createTopic(zkUtils, topicName, partitions, replifactor, new Properties());
System.out.println("created/updated topic..");
}
Note: createTopic() internally updates the topic if topic not available.