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

_fetch_metadata(): broker fetch metadata failed, err:timeout #97

Open lerpo opened 4 years ago

lerpo commented 4 years ago

When kafka and this lua-resty-kafka plugin are deployed on the same machine, they can be used normally, but when accessing kafka on a remote machine, the following error will be reported. Remote kafka can connect normally through kafka Tool, and host.name:172.16.0.120 is also configured

2020/06/04 18:02:42 [info] 8034#0: 7786 [lua] client.lua:141: _fetch_metadata(): broker fetch metadata failed, err:timeout, host: 172.16.0.120, port: 9092, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000 2020/06/04 18:02:42 [info] 8034#0: 7786 [lua] client.lua:152: _fetch_metadata(): all brokers failed in fetch topic metadata, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000 2020/06/04 18:03:12 [info] 8034#0: 7786 [lua] client.lua:141: _fetch_metadata(): broker fetch metadata failed, err:timeout, host: 172.16.0.120, port: 9092, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000 2020/06/04 18:03:12 [info] 8034#0: 7786 [lua] client.lua:152: _fetch_metadata(): all brokers failed in fetch topic metadata, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000 2020/06/04 18:03:12 [error] 8034#0: *7786 [lua] producer.lua:279: buffered messages send to kafka err: not found topic, retryable: true, topic: web_log, partition_id: -1, length: 1, context: ngx.timer, client: 127.0.0.1, server: 0.0.0.0:8000

who can tell me why? thanks

gbalakrishnan-cx commented 3 years ago

I do have the same issue any information regarding this would help

TommyU commented 3 years ago

I've came into this. and finally turns out the the kafka server.properties has to set host name. and be same with host name in your broker settings(which means do not put ip address in broker configs)