doujiang24 / lua-resty-kafka

Lua kafka client driver for the Openresty based on the cosocket API
BSD 3-Clause "New" or "Revised" License
801 stars 274 forks source link

producer.lua:258: buffered messages send to kafka err: not found topic, retryable: true, topic: alanwalk, partition_id: -1, length: 1 #78

Closed hgaong closed 5 years ago

hgaong commented 5 years ago

producer.lua:258: buffered messages send to kafka err: not found topic, retryable: true, topic: alanwalk, partition_id: -1, length: 1

My Kafka and nginx are on the same machine.

my nginx.conf: local broker_list = { { host = "localhost", port = 9092 }, } local topic = "alanwalk"

my kafka topics: $ bin/kafka-topics.sh --list --bootstrap-server localhost:9092 __consumer_offsets alanwalk

my kafka server.properties: listeners=PLAINTEXT://:9092 host.name=localhost

I hope to get your help.

doujiang24 commented 5 years ago

@hgaong the error message shows the truth, not found topic :)

hgaong commented 5 years ago

but i found this topic use the command:$ bin/kafka-topics.sh --list --bootstrap-server localhost:9092 .

hgaong commented 5 years ago

Is there anything else that could cause this problem?

doujiang24 commented 5 years ago

@hgaong have you created the topic manually before you send message to it?

doujiang24 commented 5 years ago

Kafka may create the topic automatically after it, then you can see it now.

@hgaong can you see the same error message now?

hgaong commented 5 years ago

I created the topic before send message.And this problem has been happening all the time.

doujiang24 commented 5 years ago

@hgaong can you see any other error messages?

doujiang24 commented 5 years ago

I'm not sure your nginx can parse the localhost address.

hgaong commented 5 years ago

2019/06/23 17:48:33 [error] 30483#30483: *5489 [lua] client.lua:150: _fetch_metadata(): all brokers failed in fetch topic metadata, context: ngx.timer, client: 120.244.107.247, server: 0.0.0.0:80 2019/06/23 17:48:33 [error] 30483#30483: *5489 [lua] client.lua:150: _fetch_metadata(): all brokers failed in fetch topic metadata, context: ngx.timer, client: 120.244.107.247, server: 0.0.0.0:80 2019/06/23 17:48:33 [error] 30483#30483: *5489 [lua] producer.lua:258: buffered messages send to kafka err: not found topic, retryable: true, topic: alanwalk, partition_id: -1, length: 1, context: ngx.timer, client: 120.244.107.247, server: 0.0.0.0:80 This is all the error logs.

doujiang24 commented 5 years ago

I'm not sure your nginx can parse the localhost address.

@hgaong it should be this, you can use 127.0.0.1 instead of localhost, both the lua side and the kafka side.

hgaong commented 5 years ago

@doujiang24 I replaced localhost with 127.0.0.1 and got this error log : 2019/06/23 18:07:27 [error] 31540#31540: *129 [lua] producer.lua:258: buffered messages send to kafka err: no resolver defined to resolve "iZ2ze89g20rp1sv4k9mxhrZ", retryable: true, topic: alanwalk, partition_id: 0, length: 2, context: ngx.timer, client: 120.244.107.247, server: 0.0.0.0:80

hgaong commented 5 years ago

@doujiang24 I replaced localhost with 127.0.0.1 and got this error log : 2019/06/23 18:07:27 [error] 31540#31540: *129 [lua] producer.lua:258: buffered messages send to kafka err: no resolver defined to resolve "iZ2ze89g20rp1sv4k9mxhrZ", retryable: true, topic: alanwalk, partition_id: 0, length: 2, context: ngx.timer, client: 120.244.107.247, server: 0.0.0.0:80

Thank you very much. You're right. #5 Here I found the answer to this problem no resolver defined to resolve.