zoukankan      html  css  js  c++  java
  • kafka 镜像操作

    kafka 提供了一个镜像操作工具 kafka-mirror-maker.sh 用于将一个集群中的数据同步到另一个集群中去。

    kafka 镜像操作工具的本质是一个消费者,从源集群中待迁移的主题消费数据,然后创建一个生产者,将消费者从源集群中拉取到的数据写入目标集群。

    将 host 为host1 的kafka环境中的主题名为“test-mirror”的数据写入到host为 host2 的环境中:

      1):首先在源集群中分别创建消费者和生产者启动配置文件:

        消费者配置文件 mirror-consumer.properties:

                bootstrap.servers=host1:9092  #指源集群的代理地址
                group.id=mirror    #消费组名

        生产者配置文件 mirror-producer.properties:

                bootstrap.servers=host2:9092    #指目标集群的代理地址

      2):运行镜像工具:

        kafka-mirror-maker.sh --consumer.config ../config/mirror-consumer.properties --producer.config ../config/mirror-producer.properties --whitelist test-mirror

        参数 --whitelist 指定要复制的主题,支持正则;

        参数 --blacklist 指定不需要复制的主题;

  • 相关阅读:
    SpringBoot学习历程
    日期和时间库Joda Time
    apache commons validator
    apache commons fileupload
    apache commons io
    apache commons compress
    apache commons codec
    apache commons email
    Http协议介绍
    Java原生Socket API
  • 原文地址:https://www.cnblogs.com/super-jing/p/11106457.html
Copyright © 2011-2022 走看看