Ubuntu 16 stand-alone installation configuration zookeeper and Kafka

Source: Internet
Author: User
Tags zookeeper

Environment Description:

    • Os:ubuntu 16.04
    • Zookeeper:zookeeper 3.4.9
    • kafka:kafka_2.11-0.11.0.0
    • JDK:JDK 8 (Kafka boot required to use to JDK)

Detailed instructions (all of the following actions are done under root user):

One, JDK installation

The JDK is divided into the following categories: JRE, OPENJDK, Oracle JDK, where we install Oracle JDK (recommended installation)

Add-apt-repository ppa:webupd8team/javaapt-get updateapt-get Install oracle-java8-installerapt-get Install Oracle-java8-set-default

To test the installation version:

Second, installation configuration Zookeeper single- machine mode

Download Zookeeper 3.4.5 and start the installation:

Cd/usr/localwget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz

Wait for installation to succeed:

Extract:

TAR-ZXVF zookeeper-3.4.9.tar.gz

The same folder exists in the same directory after decompression:

Switch to the Conf directory:

CD zookeeper-3.4.9/conf/

Copy Zoo_sample.cfg to Zoo.cfg:

CP Zoo_sample.cfg Zoo.cfg

Then edit the zoo.cfg as follows (other without tube, default):

initlimit=10synclimit=5datadir=/home/young/zookeeper/dataclientport=2181

Don't forget to create a new DataDir directory:

Mkdir/home/young/zookeeper/data

Create an environment variable for zookeeper, open the/etc/profile file, and at the very end add the following:

Vi/etc/profile

Add content as follows:

Export Zookeeper_home=/home/young/zookeeperexport path=.: $ZOOKEEPER _home/bin: $JAVA _home/bin: $PATH

After the configuration is complete, switch to the Zookeeper/bin directory and start the service:

To close the service:

This temporarily shuts down the zookeeper service, preventing the newspapers port usage error when Kafka is started below.

Three, installation configuration Kafka stand-alone mode

Download Kafka:

Cd/usr/localwget https://www.apache.org/dyn/closer.cgi?path=/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz

Extract:

TAR-ZXVF kafka_2.11-0.11.0.0.tgz

Enter the Kafka/config directory:

The above files are files that need to be modified, and the following modifications are configured:

Configuration server.properties:

The following are modified and others are default:

#broker. ID need to be changed to a positive integer, a single machine is 1 good broker.id=1# specify the port number port=9092#localhost this one and other to be modified, see the following instructions in detail host.name=localhost# Specifies the log directory of the Kafka log.dirs=/usr/local/kafka_2.11-0.11.0.0/kafka-logs# connection zookeeper configuration item, where a single machine is specified, so only localhost must be configured, For the actual production environment, additional IP addresses and port numbers need to be added here zookeeper.connect=localhost:2181

Configuration zookeeper.properties:

#数据目录dataDir =/usr/local/kafka_2.11-0.11.0.0/zookeeper/data# Client Port Clientport=2181host.name=localhost

Configuration producer.properties:

zookeeper.connect=localhost:2181

Configuration consumer.properties:

zookeeper.connect=localhost:2181

Finally, we need to copy several jar files to Kafka's libs directory, respectively Zookeeper-xxxx.jar, Log4j-xxxx.jar, Slf4j-simple-xxxx.jar, and the following:

Iv. use of Kafka

To start the Zookeeper service:

Bin/zookeeper-server-start.sh config/zookeeper.properties

Open a new window to start the Kafka service:

Bin/kafka-server-start.sh config/server.properties

At this point the stand-alone service has been completely completed ...

Ubuntu 16 stand-alone installation configuration zookeeper and Kafka

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.