简体   繁体   English

将数据从单独的kafka集群加载到Samza?

[英]Load data from separate kafka cluster to Samza?

I am trying to create a Samza job that as closely resembles the Wikipedia example job as I can make it. 我正在尝试创建一个Samza工作,使其与Wikipedia示例工作非常相似。 However in the "WikipediaFeed" object I am trying to get data from a different Kafka broker than the Kafka broker that is running when you start the Hello-Samza grid. 但是,在“ WikipediaFeed”对象中,我试图从与启动Hello-Samza网格时正在运行的Kafka代理不同的Kafka代理获取数据。

Do I have to create a thread safe Kafka consumer inside the "WikipediaFeed" object to consume data from a different Kafka cluster or is there another way I'm not seeing? 我是否必须在“ WikipediaFeed”对象内创建一个线程安全的Kafka使用者以使用来自不同Kafka群集的数据,或者还有别的看不到的方式吗?

Edit 1: Here is a link to their Wikipedia example. 编辑1:这是指向其Wikipedia示例的链接。 https://github.com/apache/samza-hello-samza/tree/master/src/main https://github.com/apache/samza-hello-samza/tree/master/src/main

Thanks 谢谢

In your example you need change this config ( https://github.com/apache/samza-hello-samza/blob/master/src/main/config/wikipedia-feed.properties ) : 在您的示例中,您需要更改此配置( https://github.com/apache/samza-hello-samza/blob/master/src/main/config/wikipedia-feed.properties ):

systems.kafka.consumer.zookeeper.connect=KAFKA_CLUSTER_FRONTING:2181
systems.kafka.producer.bootstrap.servers=KAFKA_CLUSTER_FRONTING:9092
task.inputs=kafka.topic1,kafka.topic2,kafka.topic3

Change the config with your Fronting Kafka cluster and add your topic in task.inputs separated with "," 使用Fronting Kafka集群更改配置,并将主题添加到task.inputs中,以“,”分隔

Edit: Just to be clear, you can deploy your Samza into a Cluster 1 and consume a Kafka topic from another cluster. 编辑:为了清楚起见,您可以将Samza部署到集群1中,并使用另一个集群中的Kafka主题。 You need change the config in your Samza properties. 您需要在Samza属性中更改配置。

To see more information : Samza config 查看更多信息: Samza配置

Then if you need send your message after process to another Kafka cluster you will need create another system in your config. 然后,如果您需要将处理后的消息发送到另一个Kafka集群,则需要在配置中创建另一个系统。

See more information : https://samza.apache.org/learn/documentation/0.13/api/overview.html 查看更多信息: https : //samza.apache.org/learn/documentation/0.13/api/overview.html

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

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