首页 > 其他分享 >Kafka集群数据同步 MirrorMaker详解

Kafka集群数据同步 MirrorMaker详解

时间:2023-07-27 11:22:24浏览次数:53  
标签:License kafka 详解 集群 mirror MirrorMaker Kafka

1、什么是MirrorMaker?

MirrorMaker是Kafka附带的一个用于在Kafka集群之间制作镜像数据的工具。该工具主要作用是从源集群中消费并生产到目标集群。

一个集群可以启动多个MirrorMaker配置到多个Kafka集群;

2、如果想在Kafka测试集群,同步线的Kafka数据,做测试使用

1、在测试集群配置mirror-consumer.properties文件示例,配置①消费者组和②消费位置以及③线上的Kafka集群地址

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# see org.apache.kafka.clients.consumer.ConsumerConfig for more details

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
bootstrap.servers=kafka0:9092,kafka1:kafka2:9092

# consumer group id
group.id=mirror-consumer-group

# What to do when there is no initial offset in Kafka or if the current
# offset does not exist any more on the server: latest, earliest, none
auto.offset.reset=earliest

 

2、在测试集群配置mirror-producer.properties文件示例,配置线下集群的测试地址和压缩方式

############################# Producer Basics #############################

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
bootstrap.servers=192.168.1.200:9092,192.168.1.201:9092,192.168.1.203:9092

# specify the compression codec for all data generated: none, gzip, snappy, lz4, zstd
compression.type=none

# name of the partitioner class for partitioning events; default partition spreads data randomly
#partitioner.class=

# the maximum amount of time the client will wait for the response of a request
#request.timeout.ms=

# how long `KafkaProducer.send` and `KafkaProducer.partitionsFor` will block for
#max.block.ms=

# the producer will wait for up to the given delay to allow other records to be sent so that the sends can be batched together
#linger.ms=

# the maximum size of a request in bytes
#max.request.size=

# the default batch size in bytes when batching multiple records sent to a partition
#batch.size=

# the total bytes of memory the producer can use to buffer records waiting to be sent to the server
#buffer.memory=

  

3、配置启动脚本start-mirror-maker.sh,和要同步的kafka数据;

/home/pirate/programs/kafka/bin/kafka-mirror-maker.sh --consumer.config /home/pirate/programs/kafka/config/mirror-consumer.properties --producer.config /home/pirate/programs/kafka/config/mirror-producer.properties --whitelist 'dwm_instance|slgjp-udplog-instance' &

  

参考:Kafka 集群数据备份 MirrorMaker 详解

拓展:kafka 异步双活方案 mirror maker2 深度解析

标签:License,kafka,详解,集群,mirror,MirrorMaker,Kafka
From: https://www.cnblogs.com/-courage/p/17584465.html

相关文章

  • Java方法详解
    Java方法详解什么是方法-System.out.println(),那么她是什么?-Java方法是语句的集合,它们在一起执行一个功能1方法是解决一类问题的步骤的有序组合2方法包含于类或对象中3方法在程序中被创建,在其他地方被引用-设计方法的原则:方法的本意是功能......
  • GDB详解
    GDB调试启动gdb调试的方法一般有三种方式:gdbfilenamegdbattachpidgdbfilenamecorename方法一直接调试目标程序gdbfilenamefilename就是需要启动调试的程序文件名,直接gdb启动一个程序进行调试,也就是说这个程序还没有启动。方法二附加进程gdbattachpid一个程......
  • java线程详解
    java线程详解线程概念说到线程,就不得不提进程,为什么呢,因为进程是操作系统进行分配资源和调度的最小单位,比如windows系统安装的应用软件(office、qq、微信等)启动时,由操作系统协调分配资源和调度执行称之为一个进程,进程间是相互独立和隔离的。而线程是进程最小执行单位,一个进程的......
  • 定位详解
    定位这个东西,blablabla,什么absolute,fixed...一头雾水定位=定位模式+边偏移定位模式......
  • kafka rebalance 总结(更新中)
    KAFKA2.3 以后,consumer分为dynamic和static,以是否设置了group.instance.id属性区分。以默认的consumer为例,即dynamicconsumer,以下图描述其正常的生命周期:依赖FindCoordinator,JoinGroup,SyncGroup,Heatbeat,LeaveGroup等接口,kafkaconsumer 和broker联合......
  • Windows中安装和使用Kafka
    一、打开Kafka官网进行下载Kafka官网地址:https://kafka.apache.org/downloads我下载的版本是3.5.0二、下载完毕之后进行解压   因为Kafka的运行依赖于Zookeeper,所以还需要下并安装Zookeeper,ZooKeeper和Kafka版本之间有一定的对应关系,不同版本的ZooKeeper和Kafka可以......
  • 【项目实战】Java 开发 Kafka 生产者
    ......
  • 【项目实战】Java 开发 Kafka 消费者
    ......
  • 【项目实战】Kafka 生产者幂等性和事务
    ......
  • 【项目实战】Kafka 重平衡 Consumer Group Rebalance 机制
    ......