不同阿里云账号之间kafka元数据的迁移(topic和group)

使用阿里云的kafka-migration工具可以对阿里云上面的kafka元数据进行迁移
https://help.aliyun.com/document_detail/155520.html

topic的迁移
下载工具的jar包
https://aliware-images.oss-cn-hangzhou.aliyuncs.com/Kafka/migration%20tool/2021-08-11/kafka-migration.jar?spm=a2c4g.11186623.0.0.14e7217eegBzQm&file=kafka-migration.jar
安装jdk1.8的环境

查看topic

[root@ops backup]# java -jar kafka-migration.jar TopicMigrationFromAliyun --sourceAk LTAI5tRiq8bAi3N89xxxxxx --sourceSk 3cUsQYCmKvzINzEtiPqxxxxxxx --sourceRegionId cn-beijing --sourceInstanceId alikafka_pre-cn-nxxxan2004 --destAk LTAI5tNmPSzKKxxxxxxxx --destSk MeA2MddZgkyk2qXcF3xxxxxxx --destRegionId cn-beijing --destInstanceId alikafka_post-cn-2xxxm1xp001 
16:12:18 INFO - Reflections took 119 ms to scan 1 urls, producing 6 keys and 14 values  
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
16:12:19 INFO - cmd=TopicMigrationFromAliyun, request=null, response={"total":61,"code":200,"requestId":"6B21589C-BC98-5A06-A444-F4C54D3D994F","success":true,"pageSize":10000,"currentPage":1,"message":"operation success.","topicList":[{"instanceId":"alikafka_pre-cn-n6w1wcan2004","localTopic":false,"createTime":1658391386000,"regionId":"cn-beijing","statusName":"服务中","topic":"GROUP_FINANCE_EXPORT_DATA_DEBUG","remark":"GROUP_FINANCE_EXPORT_DATA_DEBUG","partitionNum":6,"compactTopic":false,"status":0,"tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","localTopic":false,"createTime":1658391363000,"regionId":"cn-beijing","statusName":"服务中","topic":"GROUP_FINANCE_EXPORT_DATA","remark":"GROUP_FINANCE_EXPORT_DATA","partitionNum":6,"compactTopic":false,"status":0,"tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","localTopic":false,"createTime":1657535605000,"regionId":"cn-beijing","statusName":"服务中","
16:12:19 INFO - Will create topic:EMPLOYEE_ENTRANCE_AUTH, isCompactTopic:false, partition number:4 
16:12:19 INFO - Will create topic:RequestSuccessLogTopic, isCompactTopic:false, partition number:4 
16:12:19 INFO - Will create topic:JOIN_REWARD_ACTIVITY, isCompactTopic:false, partition number:4 
16:12:19 INFO - Will create topic:REGISTER, isCompactTopic:false, partition number:4 
16:12:19 INFO - Will create topic:NEW_FIRST_LOGIN, isCompactTopic:false, partition number:4 

参数 描述
sourceAk 源消息队列Kafka版实例所属阿里云账号的AccessKey ID
sourceSk 源消息队列Kafka版实例所属阿里云账号的AccessKey Secret
sourceRegionId 源消息队列Kafka版实例的地域ID
sourceInstanceId 源消息队列Kafka版实例的ID
destAk 目标消息队列Kafka版实例所属阿里云账号的AccessKey ID
destSk 目标消息队列Kafka版实例所属阿里云账号的AccessKey Secret
destRegionId 目标消息队列Kafka版实例的地域ID
destInstanceId 目标消息队列Kafka版实例的ID
降查询出的topic提交到新的kafka中

亚太地区
云服务 地域名称 所在城市 Region ID
公共云 华东1 杭州 cn-hangzhou
华东2 上海 cn-shanghai
华北1 青岛 cn-qingdao
华北2 北京 cn-beijing
华北3 张家口 cn-zhangjiakou
华南1 深圳 cn-shenzhen
中国香港 香港 cn-hongkong
亚太东南1 新加坡 ap-southeast-1
亚太东南5 雅加达 ap-southeast-5
亚太东北1 东京 ap-northeast-1
政务云 华北2 北京 cn-north-2-gov-1
金融云 华东1 杭州 cn-hangzhou-finance
华东2 上海 cn-shanghai-finance-1
华南1 深圳 cn-shenzhen-finance-1

欧洲与美洲
云服务 地域名称 所在城市 Region ID
公共云 欧洲中部1 法兰克福 eu-central-1
美国西部1 硅谷 us-west-1

提交topic到新kafka中

[root@ops backup]# java -jar kafka-migration.jar TopicMigrationFromAliyun --sourceAk LTAxxRiq8bAi3N89xxxxxx --sourceSk 3cUsQYCmKvzINzEtiPqxxxxxxx --sourceRegionId cn-beijing --sourceInstanceId alikafka_pre-cn-nxxxan2004 --destAk LTAI5tNmPSzKKxxxxxxxx --destSk MeA2MddZgkyk2qXcF3xxxxxxx --destRegionId cn-beijing --destInstanceId alikafka_post-cn-2xxxm1xp001 --commit

查询group并提交到新kafak中

java -jar kafka-migration.jar ConsumerGroupMigrationFromAliyun --sourceAk LTAI5xRiq8bAi3Nxxxxxx --sourceSk 3cUsQYCmKxzINzEtxxxxxxd7wxxf --sourceRegionId cn-beijing --sourceInstanceId alikafka_pre-cn-n6w1xxxxxxx --destAk LTAI5tNxPSzKKULDcSxxxxxx --destSk MeA2Mddxxkyk2qXcF3k5lyxxxxxx --destRegionId cn-beijing --destInstanceId alikafka_post-cn-2xxx2ym1xp001
16:18:46 INFO - Reflections took 104 ms to scan 1 urls, producing 6 keys and 14 values  
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
16:18:47 INFO - cmd=ConsumerGroupMigrationFromAliyun, request=null, response={"code":200,"requestId":"247DF1C0-29E9-55D1-B3B5-9F062771CEA0","success":true,"consumerList":[{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"usetime","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"payBack","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workflowStatusChange","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"carSpaceBillReceivePayment","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"requestsuccesslog","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorder-wechat-notice","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"test","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"zlx_cs","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"householdAutoEntrance","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"updateUserPhone","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"faceMSynWhite","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"bindFaceDevice","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"buriedPoint","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"zipkin","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"silentCancel","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"collectCardPrize","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"pushFeedback","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"eventMessage","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"scoreStat","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorderEmergency","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorderTypeChange","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorderDispatchUser","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorderPress","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorderNotice","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"workorderStatusChange","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"houseAddressUpdate","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"preBuildBill","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"syncHousehold","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"yueheAccountRegisterMap","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"syncHouse","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"dataImport","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"areaImport","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"areaFlush","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"deleteControl","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"addControl","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"bindDevice","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"redPacketDeliverUser","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"advertStat","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"joinConsumeActivity","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"recommendPost","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"robotPost","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"exportData","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"goodsCatalogChange","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"oldHouseholdAutoEntrance","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"pushStationLetter","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"sendMarketingSms","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"communityInitPost","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"removeUserHouse","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"joinActivity","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"push","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"payRecordStatusChange","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"addUserHouse","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"employeeAutoEntrance","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"joinRewardActivity","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"register","tags":[]},{"instanceId":"alikafka_pre-cn-n6w1wcan2004","regionId":"cn-beijing","consumerId":"firstLoginAuth","tags":[]}],"message":"operation success."} 
16:18:47 INFO - Total consumer group number:56 
16:18:47 INFO - Check instance capacity success! 
16:18:47 INFO - Will create consumer groups:[usetime, payBack, workflowStatusChange, carSpaceBillReceivePayment, requestsuccesslog, workorder-wechat-notice, test, zlx_cs, householdAutoEntrance, updateUserPhone, faceMSynWhite, bindFaceDevice, buriedPoint, zipkin, silentCancel, collectCardPrize, pushFeedback, eventMessage, scoreStat, workorderEmergency, workorderTypeChange, workorderDispatchUser, workorderPress, workorderNotice, workorderStatusChange, houseAddressUpdate, preBuildBill, syncHousehold, yueheAccountRegisterMap, syncHouse, dataImport, areaImport, areaFlush, deleteControl, addControl, bindDevice, redPacketDeliverUser, advertStat, joinConsumeActivity, recommendPost, robotPost, exportData, goodsCatalogChange, oldHouseholdAutoEntrance, pushStationLetter, sendMarketingSms, communityInitPost, removeUserHouse, joinActivity, push, payRecordStatusChange, addUserHouse, employeeAutoEntrance, joinRewardActivity, register, firstLoginAuth]

提交

[root@ops backup]# java -jar kafka-migration.jar ConsumerGroupMigrationFromAliyun --sourceAk LTAI5xRiq8bAi3Nxxxxxx --sourceSk 3cUsQYCmKxzINzEtxxxxxxd7wxxf --sourceRegionId cn-beijing --sourceInstanceId alikafka_pre-cn-n6w1xxxxxxx --destAk LTAI5tNxPSzKKULDcSxxxxxx --destSk MeA2Mddxxkyk2qXcF3k5lyxxxxxx --destRegionId cn-beijing --destInstanceId alikafka_post-cn-2xxx2ym1xp001 --commit
15:15:03 INFO - cmd=ConsumerGroupMigrationFromAliyun, request=null, response={"code":200,"requestId":"1A87AE04-E357-5119-B93A-A0467A26A175","success":true,"message":"operation success"} 
15:15:03 INFO - ConsumerCreate success, consumer group=joinRewardActivity 
15:15:10 INFO - cmd=ConsumerGroupMigrationFromAliyun, request=null, response={"code":200,"requestId":"4EE9AC00-7B77-524C-BBA6-B0E0B639B244","success":true,"message":"operation success"} 
15:15:10 INFO - ConsumerCreate success, consumer group=register 
15:15:18 INFO - cmd=ConsumerGroupMigrationFromAliyun, request=null, response={"code":200,"requestId":"FD950C10-C140-5368-B05D-E3538F5E4004","success":true,"message":"operation success"} 
15:15:18 INFO - ConsumerCreate success, consumer group=firstLoginAuth 
15:15:23 INFO - Report meta data success, migrationType:consumer_from_aliyun, total:56, succeed:56, failed:0, progress:56/56
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 213,186评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,858评论 3 387
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 158,620评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,888评论 1 285
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 66,009评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 50,149评论 1 291
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,204评论 3 412
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,956评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,385评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,698评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,863评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,544评论 4 335
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 40,185评论 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,899评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,141评论 1 267
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,684评论 2 362
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,750评论 2 351

推荐阅读更多精彩内容