Now that we have downloaded Apache Kafka to our local computer, we can run it and see if it works.
Now, at the time of recording this video lesson, there are two different ways to start Apache Kafka.
One way is to start Apache Kafka with zookeeper, which is now an old way of doing it.
And another way is to start Apache Kafka with craft mode, which is now a new way of starting Apache
Kafka.
So because Zookeeper is going to be deprecated and will not be available in future Apache Kafka versions,
I will start my Apache Kafka server using craft.
And if I list files inside of Apache Kafka folder, there should be a folder called config.
If I list files inside of this config folder.
I should see a folder that is called Kraft.
This one Kraft stands for Kafka.
Kraft, which is the name of consensus protocol that Kafka uses to coordinate the metadata changes among
brokers or Kafka servers.
And inside of this Kraft folder you will find three configuration files.
So if I list files inside of the config kraft folder.
There are three configuration files.
One of them is broker then controller properties and server properties.
The controller properties file.
It contains configuration for the server that acts as a controller, which is responsible for managing
the cluster metadata and coordinating the leader election for partitions.
The broker properties.
This file contains configuration for a server that acts as a broker, which is responsible for storing
and serving data for topics and partitions, and this server dot properties file.
It contains configuration for a server that acts as both controller and broker.
So it's like 2 in 1.
And in the following lessons I'm going to use this file to start Kafka Server.
All right.
So to start Kafka Server I will need to use a special command that is inside of a bin folder.
So if I list files inside of Kafka folder I will see a folder that is called bin.
Inside of this bin folder you will find different executable files.
For example, if I list files inside of the bin folder, I will see many executable files with extension
dot s h.
And if you're on windows then your executable files will be in the folder that is called windows.
So to list those files I will use command LZ.
And then they are also inside of the bin folder.
And the windows folder is inside of the bin folder.
So if I list files inside of the windows folder there will be the same list of files, but with extension
Bat which you can use on windows.
Now before I can start Kafka Server, there are a couple of commands that I need to run first, and
the first command is to generate a unique ID for my Kafka cluster.
The command is inside of the bin folder, so I will refer to bin folder and then forward slash.
And the file is called Kafka dash storage dot s h.
Space random Uuid like this.
If I hit enter.
This will generate a unique identifier that you will need to use to configure your Kafka cluster.
The second command that I will need to run is to format log directories using this unique identifier.
It is actually going to be the same script that I will need to run.
So it is inside of the bin folder and it is called Kafka Dash storage dash space.
Then I will type format space, dash T, and then copy and paste the cluster ID that I have just generated.
I will add one more space and paste the value of cluster ID space, and then dash C space.
And with the c parameter, I will need to specify the configuration file that I want to use for my Kafka
server.
I can start Kafka server with different configuration if needed, and with this parameter I can provide
configuration file to use.
So the configuration file that I will use this time is inside of config folder, inside of craft folder
and the file is called server.properties.
All right.
So this will prepare the storage directories for running Kafka in craft mode.
And now we can try running Kafka Server.
And to do that I will use a script that is inside of bin folder as well.
And the script is called Kafka Dash server dash Start.sh.
And then I will type space and after the space I'll need to provide configuration file that I want to
use to start Kafka Server.
And the configuration file is inside of config folder, inside of craft folder, and the file is called
server.properties.
Now, at this moment, this configuration file contains basic default configuration properties, which
are enough for development purposes.
But if you want to run more than one Kafka server, for example, or if you want to configure your Kafka
server to run in production environment, then this configuration file will need to be updated.
So let's hit enter and run our Kafka server with default configuration properties first.
And my Kafka server is up and running.
All right, so now that our Kafka server is up and running, we are good to continue to the next lesson.