Kafka 0.8.2 ConsumerMetadataRequest 总是 return ConsumerCoordinatorNotAvailableCode

Kafka 0.8.2 ConsumerMetadataRequest always return ConsumerCoordinatorNotAvailableCode

我正在使用 kafka 0.8.2, I want to use the fetch and commit offset API, as the document said

The offsets for a given consumer group are maintained by a specific broker called the offset coordinator. i.e., a consumer needs to issue its offset commit and fetch requests to this specific broker. It can discover the current offset coordinator by issuing a consumer metadata request

所以我发送 ConsumerMetadataRequest,而不是得到正确的响应,我总是得到 ConsumerCoordinatorNotAvailableCode

The broker returns this error code for consumer metadata requests or offset commit requests if the offsets topic has not yet been created.

如果我使用 kafka 0.8.2beta 版本,则没有问题。

我还使用 go 客户端 sarama,我在获取元数据之前创建了 __consumer_offsets 主题。这是我的配置:

broker.id=1
port=9091
host.name=192.168.33.10
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=data/9091
num.partitions=1
num.recovery.threads.per.data.dir=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
log.cleaner.enable=false
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=6000

我刚刚发现了一个类似的问题。问题是消费者尚未为消费者组发出 ConsumerMetadataRequest。

我发现,如果收到作为错误返回的 ConsumerCoordinatorNotAvailableCode,则必须发送 ConsumerMetadataRequest 并重试并返回。

我刚刚发现,这是我的Scale版本出现的问题,当我使用Scale的2.9.1版本时,它成功了,但在2.10中失败了。我对Scala不熟,所以不深