1

当我增加卡夫卡生产者的数量时,我遇到了错误。任何人都知道这里可能是什么问题?

请找到我的制作人设置: 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

作为参考,我的卡夫卡代码:

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;
        }
};
4

1 回答 1

1

它只是无法在 TCP 级别连接 - 也许是网络问题?

从跟踪转储的早期行来看,很明显 Kafka 使用Exception::Class进行错误处理。抛出的特定异常是Kafka::Exception::Connection并且消息是“无法绑定:主题 = 'testing_producer'”,根据文档,这是由以下原因引起的:

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

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

于 2016-03-03T05:44:08.933 回答