Kafka Lesson Learned

After a while working with Kafka. I usually use some command and I also met some issues. I would like to write it here as a note. So you and I can read it as need.

Winners .. Are not those who never fail but those who never quit!

Winners .. Are not those who never fail but those who never quit!

Issue #1:  Cannot locate memory

With this issue, we should change bin/kafka-server-start.sh:

After that, restart your Kafka

Issue #2: You want to try run Kafka with the replication.

You just need to create multiple configuration file and start Kafka:

Command #1: Create Kafka topic

Command #2: Change Kafka topic partitions

Command #3: Delete Kafka topic

You have to change conf/server.properties file

And restart and delete topic with command:

Command #4: Delete the old data

Change retention.ms config to 1 second

Restore to retention.ms to the default value:

Command #5: List topcis

Tips

We should run Kafka in Ubuntu Upstart, It will help you restart Kafka if crashes.

Create Upstart for Zookeeper in the first, /etc/init/zookeeper.conf:

And Upstart for Kafka, /etc/init/kafka.conf:

Now, the system will start Zookeeper and Kafka on the startup. Or you can start in manually by command: