May 26, 2021 Apache Kafka
1. Step 1 - Verify the Java installation
2. Step 2 - ZooKeeper frame installation
Here are the steps to install Java on the machine.
Hopefully you've installed java on your machine, so you just need to verify it using the command below.
$ java -version
If java is successfully installed on your machine, you can see the installed version of Java.
If you are not downloading Java, download the latest version of JDK by visiting the link below and downloading the latest version.
http://www.oracle.com/technetwork/java/javase/downloads/index.htmlThe latest version is now JDK 8u 60, and the file is "jdk-8u60-linux-x64.tar.gz". /b10> Please download the file on your machine.
Typically, the file being downloaded is stored in the download folder, verified, and the tar settings are extracted using the following commands.
$ cd /go/to/download/path $ tar -zxf jdk-8u60-linux-x64.gz
To make java available to all users, move the extracted java content to
usr/local/java/folder.
$ su password: (type password of root user) $ mkdir /opt/jdk $ mv jdk-1.8.0_60 /opt/jdk/
To set the path JAVA_HOME variables, add the following command to the .bashrc file.
export JAVA_HOME =/usr/jdk/jdk-1.8.0_60 export PATH=$PATH:$JAVA_HOME/bin
All changes are now applied to the currently running system.
$ source ~/.bashrc
Use the following command to change Java Alternatives.
update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_60/bin/java 100
Step 1.6 - Now verify java with the verification command (java -version) described in step 1.
To install the ZooKeeper framework on your computer, visit the link below and download the latest version of zooKeeper.
http://zookeeper.apache.org/releases.htmlThe latest version of ZooKeeper is now 3.4.6 (ZooKeeper-3.4.6.tar.gz).
Use the following commands to extract the tar file
$ cd opt/ $ tar -zxf zookeeper-3.4.6.tar.gz $ cd zookeeper-3.4.6 $ mkdir data
Use the command "conf/ zoo.cfg" to open a
profile named conf/zoo .cfg
and set all of the following parameters as a starting point.
$ vi conf/zoo.cfg tickTime=2000 dataDir=/path/to/zookeeper/data clientPort=2181 initLimit=5 syncLimit=2
Once the profile is successfully saved and returned to the terminal again, you can start the zookeyer server.
$ bin/zkServer.sh start
After executing this command, you will get a response like the following -
$ JMX enabled by default $ Using config: /Users/../zookeeper-3.4.6/bin/../conf/zoo.cfg $ Starting zookeeper ... STARTED
$ bin/zkCli.sh
After entering the command above, you will be connected to the zookeyer server and will receive the following response.
Connecting to localhost:2181 ................ ................ ................ Welcome to ZooKeeper! ................ ................ WATCHER:: WatchedEvent state:SyncConnected type: None path:null [zk: localhost:2181(CONNECTED) 0]
After connecting the server and doing everything, you can use the following command to stop the zookeeper server -
$ bin/zkServer.sh stop
Now you've successfully installed Java and ZooKeeper on your machine. /b10> Let's take a look at the steps to install Apache Kafka.
Let's continue with the following steps to install Kafka on your machine.
To install Kafka on your machine, please click on the link below -
https://www.apache.org/dyn/closer.cgi?path=/kafka/0.9.0.0/kafka_2.11-0.9.0.0.tgzNow the latest version, kafka_2.11-0.9.0.0.tgz, will be downloaded to your computer.
Use the following command to extract the tar file -
$ cd opt/ $ tar -zxf kafka_2.11.0.9.0.0 tar.gz $ cd kafka_2.11.0.9.0.0
You have now downloaded the latest version of Kafka on your machine.
You can start the server by giving the following command -
$ bin/kafka-server-start.sh config/server.properties
After the server starts, you'll see the following response on the screen:
$ bin/kafka-server-start.sh config/server.properties [2016-01-02 15:37:30,410] INFO KafkaConfig values: request.timeout.ms = 30000 log.roll.hours = 168 inter.broker.protocol.version = 0.9.0.X log.preallocate = false security.inter.broker.protocol = PLAINTEXT ……………………………………………. …………………………………………….
After all the operations have been performed, the server can be stopped using the following command -
$ bin/kafka-server-stop.sh config/server.properties
Now that we've discussed Kafka installation, we can learn how to do the basics of Kafka in the next chapter.