尝试将第一条消息发布到新主题时,日志中出现以下错误。
[WARN] [o.a.kafka.clients.NetworkClient] [[制作人 clientId = producer-1]提取具有相关ID的元数据时出错 766890:{myTopic-1 = INVALID_REPLICATION_FACTOR, myTopic-2 = INVALID_REPLICATION_FACTOR}] []
kafka失败挂在:
"Hashed wheel timer #1" #521 prio=5 os_prio=0 tid=0x00007f932cd7d000 nid=0x199fa in Object.wait() [0x00007f9322b79000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
at org.apache.kafka.clients.Metadata.awaitUpdate(Metadata.java:177)
- locked <0x000000047838b990> (a org.apache.kafka.clients.Metadata)
at org.apache.kafka.clients.producer.KafkaProducer.waitOnMetadata(KafkaProducer.java:903)
at org.apache.kafka.clients.producer.KafkaProducer.doSend(KafkaProducer.java:794)
at org.apache.kafka.clients.producer.KafkaProducer.send(KafkaProducer.java:784)
我们使用的kafka jar版本是:0.10.0.1
代理上的server.properties是:
broker.id=3
host.name=<>
port=9092
message.max.bytes=20971520
num.partitions=30
auto.create.topics.enable=true
# Replication configurations
default.replication.factor=2
num.replica.fetchers=2
replica.fetch.max.bytes=20971520
log.dirs=/mnt1/data/kafka/kafka-logs-3
log.retention.hours=48
log.flush.interval.ms=10000
log.flush.interval.messages=20000
log.flush.scheduler.interval.ms=2000
log.cleanup.interval.mins=30
zookeeper.connect=<>
zookeeper.connection.timeout.ms=1000000
# Socket server configuration
num.io.threads=8
num.network.threads=8
socket.request.max.bytes=20971520
socket.receive.buffer.bytes=20971520
socket.send.buffer.bytes=20971520
queued.max.requests=32
fetch.purgatory.purge.interval.requests=100
producer.purgatory.purge.interval.requests=100
inter.broker.protocol.version=0.10.2.0
log.message.format.version=0.10.0
delete.topic.enable=true
为什么我无法发送消息?主题本身尚未创建! 使用的生产者属性是:
Properties props = new Properties();
props.put("acks", "0");
props.put("retries", "0");
props.put("batch.size", "16384");
props.put("linger.ms", "100");
props.put("buffer.memory", "33554432");
props.put("key.serializer", "org.apache.kafka.common.serialization.IntegerSerializer");
props.put("value.serializer", "org.apache.kafka.common.serialization.StringSerializer");
props.put("max.request.size", String.valueOf(ByteUnit.MB.toBytes(10)));
return props;
答案 0 :(得分:0)
您在集群中有多少经纪人? default.replication.factor
是2
,这意味着您必须至少运行2个代理。
答案 1 :(得分:0)
我遇到了同样的问题,在搜索Kafka代码库时,我意识到在某些情况下,getUserByEmail()
被报告为Errors.COORDINATOR_NOT_AVAILABLE
对于我来说,实际的根本问题是使用者配置中指定的主题不存在