我对Kafka和Samza很新。我尝试了hello-samza例子,它正在工作。我正在寻找的是创建一个从kafka主题读取消息的samza任务。我添加的任务不会抛出任何错误,也不会从主题中读取任何消息。纱线UI将任务显示为已接受。不确定我在这里做错了什么。
这是班级
public class MyTask implements StreamTask {
@Override
public void process(IncomingMessageEnvelope incomingMessageEnvelope, MessageCollector messageCollector, TaskCoordinator taskCoordinator) throws Exception {
System.out.println(" key - " + incomingMessageEnvelope.getKey() + " | message " + incomingMessageEnvelope.getMessage());
}
}
这是属性文件
# Job
job.factory.class=org.apache.samza.job.yarn.YarnJobFactory
job.name=addresses
# YARN
yarn.package.path=file://${basedir}/target/${project.artifactId}-${pom.version}-dist.tar.gz
# Task
task.class=samza.examples.wikipedia.task.MyTask
task.inputs=addressestopic
# Serializers
serializers.registry.json.class=org.apache.samza.serializers.JsonSerdeFactory
# Kafka System
systems.kafka.samza.factory=org.apache.samza.system.kafka.KafkaSystemFactory
systems.kafka.samza.msg.serde=json
systems.kafka.consumer.zookeeper.connect=localhost:2181/
systems.kafka.producer.bootstrap.servers=localhost:9092
# Job Coordinator
job.coordinator.system=kafka
# Add configuration to disable checkpointing for this job once it is available in the Coordinator Stream model
# See https://issues.apache.org/jira/browse/SAMZA-465?focusedCommentId=14533346&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14533346 for more details
job.coordinator.replication.factor=1
答案 0 :(得分:3)
如果Yarn UI显示您的作业处于“ACCEPTED”状态而不是“RUNNING”,那么Yarn可能还没有找到资源来运行您的Samza作业。
通常,我注意到当你在你正在执行的本地盒上的磁盘空间不足时会发生这种情况。