Apache Kafka-3 Installation Steps

Source: Internet
Author: User
Tags mkdir zookeeper
Apache Kafka Tutorial Apache Kafka-Installation Steps

Personal blog Address: http://blogxinxiucan.sh1.newtouch.com/2017/07/13/apache-kafka-installation Steps/ Apache Kafka-Installation Steps Step 1-Verify the Java installation

I hope you have already installed Java on your computer, so you only need to verify it with the following command.

$ java-version

If you have successfully installed Java on your computer, you can see the installed Java version.

Step 1.1-Download the JDK
If Java is not downloaded, please download the latest version of the JDK via the link below and download the latest version.

Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Now the latest version is JDK 8u 60, the file is "jdk-8u60-linux-x64.tar.gz". Please download the file on your machine.

Step 1.2-Extract the files
In general, the files being downloaded are stored in the download folder, and the following commands are used to verify and extract the tar settings.

$ cd/go/to/download/path
$ tar-zxf jdk-8u60-linux-x64.gz

Step 1.3-Move to select Directory
To make Java available to all users, move the extracted Java content to the Usr/local/java/folder.

$ su
password: (type password of root user)
$ mkdir/opt/jdk
$ mv jdk-1.8.0_60/opt/jdk/

Step 1.4-Set the path
To set the path and the Java_home variable, add the following command to the 〜/. bashrc file.

Export Java_home =/usr/jdk/jdk-1.8.0_60
export path= $PATH: $JAVA _home/bin

Now apply all the changes to the currently running system.

$ source ~/.BASHRC

Step 1.5-java Alternative Solutions
Use the following command to change the Java alternatives.

Update-alternatives--install/usr/bin/java Java/opt/jdk/jdk1.8.0_60/bin/java 100

Step 1.6-now use the Validation command (java-version) described in step 1 to verify Java. Step 2-zookeeper Frame Installation

Step 2.1-Download Zookeeper
To install the Zookeeper framework on your machine, please visit the link below and download the latest version of zookeeper.

Http://zookeeper.apache.org/releases.html
Up to now, the latest version of ZooKeeper is 3.4.6 (zookeeper-3.4.6.tar.gz).

Step 2.2-Extract the tar file
Use the following command to extract the tar file

$ cd opt/
$ tar-zxf zookeeper-3.4.6.tar.gz
$ cd zookeeper-3.4.6
$ mkdir Data

Step 2.3-Create a configuration file
Use command VI "CONF/ZOO.CFG" to open a configuration file named Conf/zoo.cfg and set all of the following parameters as the starting point.

$ VI conf/zoo.cfg
ticktime=2000
datadir=/path/to/zookeeper/data
clientport=2181
initlimit=5
synclimit=2

Once the configuration file is successfully saved and returned to the terminal again, you can start the zookeeper server.

Step 2.4-Start the Zookeeper server

$ bin/zkserver.sh Start

After you execute this command, you get a response such as the following:

$ JMX enabled by default
$ Using config:/users/. /zookeeper-3.4.6/bin/. /conf/zoo.cfg
$ starting zookeeper ... STARTED

Step 2.5-Start the CLI

$ bin/zkcli.sh

After you type the above command, you will be connected to the zookeeper server and receive the following response.

Connecting to localhost:2181
Welcome to zookeeper!
Watcher::
watchedevent state:syncconnected type:none path:null
[zk:localhost:2181 (CONNECTED) 0]

Step 2.6-Stop the zookeeper server
After you connect to the server and perform all operations, you can stop the zookeeper server by using the following command-

$ bin/zkserver.sh Stop

Now you have successfully installed Java and zookeeper on your machine. Let's take a look at the steps to install Apache Kafka. Step 3-apache Kafka installation

Let's continue with the following steps to install Kafka on your machine.

Step 3.1-Download Kafka
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.tgz
Now the latest version, i.e.-kafka_2.11_0.9.0.0.tgz will be downloaded to your machine.

Step 3.2-Extract the tar file
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.

Step 3.3-Start the server
You can start the server with the following command-

$ bin/kafka-server-start.sh Config/server.properties

After the server starts, you will 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
Step 4-Stop the server

After you have performed all the actions, you can stop the server by using the following command-

$ bin/kafka-server-stop.sh Config/server.properties

1 Apache Kafka-Introduction
2 Apache Kafka-Workflow
3 Apache Kafka-Installation steps
4 Apache Kafka-Basic operation
5 Apache Kafka-producer Example
6 Apache Kafka-consumer example
7 Apache Kafka-integrated with Storm
8 Apache Kafka-integrated with Spark

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.