Learn how to create a topic on their local Kafka cluster.
- [Instructor] Now that we have Kafka up and running, it's time to create a topic. So, again, we have a Kafka topic script that comes with this, so what we'll do is open up a new terminal window where we already have ZooKeeper and Kafka running in those ones. We'll just create a new window here on top of this one so we can run our new commands. Make sure that I'm in the right directory, so if I take a look at where I'm at, I'm going to want to jump over to the downloads folder and wherever I extracted Kafka. Then, I want to run this Kafka-topics.sh script.
I'll tell it to create, I'll tell it where ZooKeeper is, which is running at local host on port 2181, I'll just use a replication factor of one for right now, with one partition and the name of test. Copy this in and as you can see we've got a message, we've created the topic of test. If I move this over, you can see what's happening here behind the scenes in ZooKeeper and Kafka. They're both spinning as they handle the command that I just issued.
Now, let's take a look at that topic. So, we'll say bin/Kafka-topics.sh list and tell it where ZooKeeper is. And there you go. It was that easy to create a topic in Kafka using the built-in script. And, again, you can see what's happening behind the scenes as all of these changes are being applied.
- Understanding the Kafka log
- Creating topics
- Partitioning topics across brokers
- Installing and testing Kafka locally
- Sending and receiving messages
- Setting up a multibroker cluster
- Testing fault tolerance