kafka集群搭建

允我心安 提交于 2019-11-30 07:58:01
# 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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!