美文网首页
6.Zookeeper+kafka 一篇就够

6.Zookeeper+kafka 一篇就够

作者: starQuest | 来源:发表于2022-06-23 14:28 被阅读0次

    6.1 Zookeeper

    解压

    tar -zxvf zookeeper-3.4.14.tar.gz

    更名

    mv zookeeper-3.4.14 zookeeper

    改配置

    cd zookeeper/conf/

    cp zoo_sample.cfg zoo.cfg

    vi zoo.cfg

    添加

    server.1=x.x.x.4:2888:3888

    server.2=x.x.x.6:2888:3888

    server.3=x.x.x.7:2888:3888

    建立文件及文件夹

    mkdir /tmp/zookeeper

    touch /tmp/zookeeper/myid

    echo 1 > /tmp/zookeeper/myid

    传输到另外2台

    scp -r zookeeper x.x.x.6:/home/software/

    scp -r zookeeper x.x.x.7:/home/software/

    启动

    ./zookeeper/bin/zkServer.sh start

    查看状态

    ./zookeeper/bin/zkServer.sh status

    成功

    image.png image.png

    6.2 Kafka

    解压

    tar -zxvf kafka_2.12-2.4.0.tgz

    mv kafka_2.12-2.4.0 kafka

    cd kafka/

    cd config/

    修改配置

    master为1

    broker.id=1

    listeners=PLAINTEXT://ZooKeeper-Kafka-01:9092

    advertised.listeners=PLAINTEXT://ZooKeeper-Kafka-01:9092

    num.network.threads=3

    num.io.threads=8

    socket.send.buffer.bytes=102400

    socket.receive.buffer.bytes=102400

    socket.request.max.bytes=104857600

    log.dirs=/tmp/kafka-logs

    num.partitions=5

    num.recovery.threads.per.data.dir=1

    offsets.topic.replication.factor=1

    transaction.state.log.replication.factor=1

    transaction.state.log.min.isr=1

    log.retention.hours=2

    log.segment.bytes=536870912

    log.retention.check.interval.ms=300000

    # 连接

    zookeeper.connect=ZooKeeper-Kafka-01:2181,ZooKeeper-Kafka-02:2181,ZooKeeper-Kafka-03:2181

    zookeeper.connection.timeout.ms=6000

    group.initial.rebalance.delay.ms=0

    # 可删除topic

    delete.topic.enable=true

    传输

    scp -r kafka x.x.x.6:/home/software/

    scp -r kafka x.x.x.7:/home/software/

    启动

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

    bin/kafka-server-stop.sh

    创建topic

    bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 2--partitions 6 --zysco_realtime

    bin/kafka-topics.sh --list --zookeeper localhost:2181

    bin/kafka-console-consumer.sh --bootstrap-server localhost:2181, -topic zysco_realtime --from-beginning

    6.3 kafka可视化工具(kafka-eagle)

    下载

    http://download.kafka-eagle.org/

    相关文章

      网友评论

          本文标题:6.Zookeeper+kafka 一篇就够

          本文链接:https://www.haomeiwen.com/subject/bvasvrtx.html