kafka集群搭建

# kafka集群,伪集群
cd /usr/local/src
wget http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.3.0/kafka_2.12-2.3.0.tgz
tar -zxv -f kafka_2.12-2.3.0.tgz -C /usr/local/
cd /usr/local/kafka_2.12-2.3.0/config
mkdir -p /kafkadata/{kafka-1,kafka-2,kafka-3}
cp server.properties server-1.properties
vim server-1.properties
	broker.id=1
	delete.topic.enable=true
	listeners=PLAINTEXT://:9092
	advertised.listeners=PLAINTEXT://localhost:9092
	log.dirs=/kafkadata/kafka-1
	zookeeper.connect=localhost:2181,localhost:2182,localhost:2183

cp server-1.properties server-2.properties
vim server-2.properties
	broker.id=2
	delete.topic.enable=true
	listeners=PLAINTEXT://:9093
	log.dirs=/kafkadata/kafka-2
	zookeeper.connect=localhost:2181,localhost:2182,localhost:2183

cp server-1.properties server-3.properties
vim server-3.properties
	broker.id=3
	delete.topic.enable=true
	listeners=PLAINTEXT://:9094
	log.dirs=/kafkadata/kafka-3
	zookeeper.connect=localhost:2181,localhost:2182,localhost:2183

# 启动集群
vim start.sh
	#!/bin/bash

	bash bin/kafka-server-start.sh -daemon config/server-1.properties
	bash bin/kafka-server-start.sh -daemon config/server-2.properties
	bash bin/kafka-server-start.sh -daemon config/server-3.properties

# 停止集群
vim stop.sh 
	#!/bin/bash

	bash bin/kafka-server-stop.sh -daemon config/server-1.properties
	bash bin/kafka-server-stop.sh -daemon config/server-2.properties
	bash bin/kafka-server-stop.sh -daemon config/server-3.properties
原文地址:https://www.cnblogs.com/sanduzxcvbnm/p/11573883.html