Kafka Single-node construction and cluster construction

Source: Internet
Author: User

First of all, Kafka run, need zookeeper in the background to run, although Kafka has built-in zookeeper, but we still build with their own distributed zookeeper

Kafka Single-node construction (with its own zookeeper)

Start the service

? 1, configure and start zookeeper services

Using Kafka built-in ZK

? Configure ZK File:/opt/kafka/config/zookeeper.properties

? Enable ZK Service:

?/opt/kafka/bin/zookeeper-server-start.sh/opt/kafka/config/zookeeper.properties >/opt/logs/kafka-zk.log 2> &1 &

? Netstat-an | grep 2181

Using the public ZK

? zookeeper.connect in/opt/kafka/config/server.properties Configure the address of an external ZK

?

? 2, Start Kafka-server

? Configure the relevant parameters/opt/kafka/config/server.properties

? Main parameters: Broker.id, Port, Log.dirs

? Start:/opt/kafka/bin/kafka-server-start.sh/opt/kafka/config/server.properties >/opt/logs/kafka-server.log 2> &1 &

Zookeeper's cluster construction

Deploying Kafka clusters is actually the number of brokers that increase Kafka.

Deploy Kafka cluster: 192.168.2.134, 192.168.2.135, 192.168.2.136

?

? 1, ZK Configuration and single node consistent.

? 2, Server Startup:

Configuration of the 192.168.2.134 node/opt/kafka/config/server.properties broker.id=0

Configuration of the 192.168.2.135 node/opt/kafka/config/server.properties broker.id=1

Configuration of the 192.168.2.136 node/opt/kafka/config/server.properties broker.id=2

? server.properties configuration for all nodes: zookeeper.connect=192.168.2.134:2181,192.168.2.135:2181,192.168.2.136:2181

? start all servers (execute this command in each console to start Kafka):/opt/kafka/bin/kafka-server-start.sh/opt/kafka/config/server.properties >/ Opt/logs/kafka-server.log 2>&1 &

? Add two copies, 3 Partitions of topic World

? bin/kafka-topics.sh--create--zookeeper 192.168.2.134:2181,192.168.2.135:2181,192.168.2.136:2181-- Replication-factor 3--partitions 2--topic World

Kafka Single-node construction and cluster construction

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.