简体   繁体   English

Kafka:在不同版本之间复制主题吗?

[英]Kafka: copy topics between different versions?

I've got two brokers. 我有两个经纪人。 the first runs 0.9 and the second runs 0.10 第一次运行0.9,第二次运行0.10

Various workers and daemons consume and produce messages on both brokers. 各种工作程序和守护程序在两个代理上消耗并产生消息。

For one application, I need messages from a 0.9 topic consumable from an application that's using KStreams and is connected to the 0.10 broker. 对于一个应用程序,我需要来自0.9主题的消息,这些消息可以从正在使用KStreams并连接到0.10 Broker的应用程序中使用。

Is there a straightforward way of copying just the one topic from 0.9 to 0.10? 是否有一种直接的方法将一个主题从0.9复制到0.10? Or using the 0.10 clients to connect to 0.9? 还是使用0.10客户端连接到0.9? I'd hate to have to resort to cramming both versions in the same jar. 我讨厌不得不在同一个罐子里塞满这两个版本。 Just consuming the 0.9 broker with a 0.10 client doesn't seem to work. 仅使用0.10客户端使用0.9代理似乎不起作用。

In general, only Kafka broker are backward compatible (not Kafka client). 通常,只有Kafka代理是向后兼容的(不是Kafka客户端)。 Thus, a client can connect to newer brokers, but not to older once. 因此,客户端可以连接到较新的代理,但不能与较旧的代理连接。

Because Kafka Streams library uses 0.10.x client, it only works with 0.10.x brokers. 由于Kafka Streams库使用0.10.x客户端,因此仅适用于0.10.x代理。

Thus, upgrading your broker as described here: https://kafka.apache.org/documentation.html#upgrade should be the best way to go (this is safe, as brokers are backward compatible, thus not breaking any other applications using this broker with older clients). 因此,如下所述升级您的代理: https : //kafka.apache.org/documentation.html#upgrade应该是最好的方法(这是安全的,因为代理是向后兼容的,因此不会破坏使用此代理的任何其他应用程序与年长的客户进行经纪)。

As an alternative, you could also use Mirror Maker to replicate the topic from 0.9.x cluster to 0.10.x cluster. 或者,您也可以使用Mirror Maker将主题从0.9.x群集复制到0.10.x群集。

my solution was to use jarjar to rewrite the 0.9 clients jar so that the classes/types don't conflict with the 0.10 client. 我的解决方案是使用jarjar重写0.9客户端jar,以使类/类型与0.10客户端不冲突。 it's dirty, but it works around the jvm's opinion on having two versions of the same library. 它很脏,但是它可以解决jvm关于拥有同一库的两个版本的意见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM