Learn how to install Kafka locally.
- [Instructor] Now let's take a look at installing Kafka locally. And this is going to work on Mac with OSX or beyond, and Windows, as well as Linux. So, for Windows the only difference is you'll have to look for the .bat files and you'll have to use slightly different syntax in Powershell, but I've noted that here, and if you have any issues, we'll actually put some clues on the screen as we go along. The first thing you're going to want to do is make sure that you have the latest Java development kit, the JDK, installed. And you can get that at this URL right here.
When we go to download the JDK, we simply click on the download for it. Then we want to accept the license agreement. We'll choose whatever platform we're on. In my case, Mac OSX. And we'll download the installer. After we've downloaded that, we need to run the installer, click next through it, and then we should be able to continue. Then we need to download the latest version of Kafka, and we can do that at kafka.apache.org/downloads Here, what I'm going to do is find the latest version and I want to get the binary downloads, not the source downloads.
And I can find the latest version there. And then it'll give me a mirror. I'll click that, and download that to my machine. Now that we've downloaded that, I'm going to jump over to terminal now. Make this a little bit bigger so you can see it. And in terminal, what I want to do is unpack that compressed file I just downloaded, so I'll jump over to my Downloads directory. And here I'm going to say tar -xzf and whatever the name of that Kafka file was.
As I mentioned, this will change over time, so make sure that you're using the correct filename for the version that you downloaded. Once that's done, I can then jump over to that directory where we can then run Kafka. So, I'll say cd, for change directory, and Kafka. Then, I need to start Zookeeper. Here's where if you didn't have the JDK installed, you would get an error. And I'm going to copy this from the exercise file, but you could just as easily type it in if you want. And when I hit enter, you're going to see all kinds of messages here.
Info, everything's up and running. And, we're good to go. Next, we need to start the Kafka servers, so I'm going to copy that, which also just runs a script, and I'll do a new tab here. And when I run this, I have the Kafka server running. So, that was all I needed for downloading and installing everything, and getting Zookeeper up and then Kafka up on my local machine.
- 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