Kafka+zookeeper Environment Configuration (Linux environment stand-alone version)

Source: Internet
Author: User
Tags zookeeper zookeeper download

Version:

Centos-6.5-x86_64

zookeeper-3.4.6

kafka_2.10-0.10.1.0

I. Zookeeper Download and Installation

1) Download

$ wget http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz

2) Unzip

Tar zxvf zookeeper-3.4.6.tar.gz

3) configuration

CD zookeeper-3.4.6

CP-RF conf/zoo_sample.cfg conf/zoo.cfg
Vim Zoo.cfg

Zoo.cfg:

Datadir=/opt/zookeeper-3.4.6/zkdata #这个目录是预先创建的
Datalogdir=/opt/zookeeper-3.4.6/zkdatalog   #这个目录是预先创建的

Please refer to Zookeeper

4) Configure Environment variables

zookeeper_home=/opt/zookeeper-3.4.6

Path= $JAVA _home/bin: $ZOOKEEPER _home/bin: $PATH
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $ZOOKEEPER _home/lib:

5) Start Zookeeper

$ sh zkserver.sh start

Two. Download and install Kafka

1). Download Kafka:

wget http://apache.fayea.com/kafka/0.10.0.1/kafka_2.10-0.10.0.1.tgz

2) Unzip:

TAR-ZXVF kafka_2.10-0.10.0.1.tgz
3) Configuration: Enter Kafka installation project root directory edit config/server.properties

Server.properties Configuration Property Description

Log.dirs=/opt/kafka_2.10-0.10.1.0/kafka_log (created in advance)

Listeners=plaintext://kafka Machine IP Address: 9092

(I'm using local localhost here.)

4) Start Kafka

$ sh bin/kafka-server-start.sh config/server.properties &

#这里我老显示启动报错.

Put the kafka_2.10-0.10.1.0/config/server.properties in.Broker.id=0 modification broker.id=1

Startup success

Note: Hanging to the background use

Detects 2181 and 9092 Port Netstat-tunlp|egrep "(2181|9092)"

5) Create a new topic

$ sh kafka-topics.sh--create--topic kafkatopic--replication-factor 1--partitions 1--zookeeper localhost:2181

$./kafka-topics.sh--list--zookeeper 192.168.61.135:2181  -View all topic

$./kafka-topics.sh--describe--zookeeper localhost:2181--topic logTopic100  --View specified topic

6) Start up the Kafka producers:

$ sh kafka-console-producer.sh--broker-list localhost:9092--sync--topic kafkatopic

7) Open another terminal to start up the consumer:

$ sh kafka-console-consumer.sh--zookeeper localhost:2181--topic kafkatopic--from-beginning
(--from Beginning is a start-up consumption, not the consumption is currently being sent to the topic message)

8) Use

Enter AAA at the terminal where the message is sent, it can be displayed at the end of the consumer message

Kafka+zookeeper Environment Configuration (Linux environment stand-alone version)

Related Article

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.