kafka:无法绑定:主题错误

erhoui1w  于 2021-06-07  发布在  Kafka
关注(0)|答案(1)|浏览(365)

我得到下面的错误,当我增加Kafka制片人的数量。有人知道这里有什么问题吗?
请查找我的生产者设置:https://gist.github.com/vibhuti/dbf1c24962b91f2bc217
错误日志:

main::catch {...} ("<UNKNOWN> Can't bind: topic = 'testing_producer' at /opt/adp/"...) called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm line 104
Try::Tiny::try(CODE(0xabdf8d0), Try::Tiny::Catch=REF(0xabdb938)) called at ./stream_binary_hadoop.pl line 184
main::stream(HASH(0xac5fde0)) called at ./stream_binary_hadoop.pl line 347
main::file_split(HASH(0xabe71e0)) called at ./stream_binary_hadoop.pl line 406

<UNKNOWN> <UNKNOWN> Can't bind: topic = 'testing_producer' at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Exception/Class/Base.pm line 85.
Exception::Class::Base::throw("Kafka::Exception::Connection", "code", -1004, "message", "Can't bind: topic = 'testing_producer'") called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Connection.pm line 1303
Kafka::Connection::_error(Kafka::Connection=HASH(0x176f9f40), -1004, "topic = 'testing_producer'") called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Connection.pm line 814
Kafka::Connection::receive_response_to_request(Kafka::Connection=HASH(0x176f9f40), HASH(0x17767738), undef) called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Kafka/Producer.pm line 363
Kafka::Producer::send(Kafka::Producer=HASH(0x176fa1f8), "testing_producer", 0, "56b4b2b23c24c3608376d1f0,/obj/i386/junos/lib/librtsock/iff_ms"...) called at ./stream_binary_hadoop.pl line 171
main::try {...} () called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm line 81
eval {...} called at /opt/adp/projects/code_coverage/perl//5.10/lib/site_perl/5.10.1/Try/Tiny.pm line 72
Try::Tiny::try(CODE(0x1776fa40), Try::Tiny::Catch=REF(0x1776a6b0)) called at ./stream_binary_hadoop.pl line 184
main::stream(HASH(0x1775f6c0)) called at ./stream_binary_hadoop.pl line 347
main::file_split(HASH(0x1775e790)) called at ./stream_binary_hadoop.pl line 406

作为参考,我的Kafka密码:

my $arcs_val = join( ',', @arc_a );
my $hadoop_str = $testid . ',' . $gcda_file_name . ',' . $arcs_val;
utf8::downgrade($hadoop_str);
try {
        #my $topic = utf8::downgrade($testid);;
        my $topic = utf8::downgrade($testid);
        my $partition = 0;
        my $response = $producer->send(
              "testing_producer",             # topic
              $partition,                  # partition
              $hadoop_str
        );
} catch {
        my $error = $_;
        if ( blessed( $error ) && $error->isa( 'Kafka::Exception' ) ) {             warn 'Error: (', $error->code, ') ',  $error->message, "\n";
              exit;
        } else {
              die $error;
        }
};
cyej8jka

cyej8jka1#

它只是无法在tcp层连接-也许是网络问题?
从跟踪转储的前面几行可以清楚地看出,kafka使用exception::class进行错误处理。抛出的特定异常是kafka::exception::connection,消息是“can't bind:topic='testing\u producer'”,根据doco,这是由以下原因引起的:

A successful TCP connection cant be established on given host and port.

作为它的tcp协议,如果客户机有一个“telnet客户机”,您可以做一个快速而简单的测试。只需在telnet客户机中输入服务器的主机名/ip和端口号,然后单击“连接”。如果它连接,只需断开连接-您将确认它不是网络。如果失败,您将确认这是一个网络问题。

相关问题