kafka:无法绑定:主题错误

时间:2016-03-02 20:49:07

标签: perl apache-kafka kafka-producer-api

当我增加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;
        }
};

1 个答案:

答案 0 :(得分:1)

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

从跟踪转储的早期行开始,很清楚Kafka使用Exception::Class进行错误处理。抛出的具体异常是 Kafka :: Exception :: Connection ,消息是“无法绑定:topic ='testing_producer'”,根据{{3是由:

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

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