无法初始化SASL身份验证:SASL握手

时间:2018-09-09 11:49:35

标签: php apache-kafka kerberos

我有一个简单的代码,可以通过Kafka连接到Kerberos

index.php

<?php

require 'vendor/autoload.php';

use Enqueue\RdKafka\RdKafkaConnectionFactory;
$i = 0;
while (true) {

// connect to Kafka broker at example.com:1000 plus custom options
$connectionFactory = new RdKafkaConnectionFactory([ 
    'global' => [
            'bootstrap.servers' =>'kafka1.dataak.dev:9096,kafka2.dataak.dev:9096, 
 kafka3.dataak.dev:9096',
    'sasl.kerberos.keytab' => 'twitter_crawler.user.keytab',
    'sasl.kerberos.service.name'=> 'kafka',
    'security.protocol' => 'SASL_PLAINTEXT',
    'sasl.kerberos.principal'=> 'twitter_crawler@KAFKA.SECURE',
    'sasl.mechanisms'=> 'GSSAPI',
],
'topic' => [
    'auto.offset.reset' => 'beginning',
],
]);

$psrContext = $connectionFactory->createContext();


$message = $psrContext->createMessage($i);

$fooTopic = $psrContext->createTopic('test');

$psrContext->createProducer()->send($fooTopic, $message);
echo $i . " success push \n";
$i++;
}

代码运行良好,但是有时在运行过程中,我会遇到以下消息:

0%2|1536492505.195|LIBSASL|rdkafka#producer-11| 
[thrd:sasl_plaintext://kafka2.dataak.dev:9096/bootstrap]: 
sasl_plaintext://kafka2.dataak.dev:9096/bootstrap: GSSAPI Error: 
Unspecified GSS failure.  Minor code may provide more information 
(Matching credential not found)
%3|1536492505.195|FAIL|rdkafka#producer-11| 
[thrd:sasl_plaintext://kafka2.dataak.dev:9096/bootstrap]: 
sasl_plaintext://kafka2.dataak.dev:9096/bootstrap: Failed to 
initialize SASL authentication: SASL handshake failed (start (-1)): 
SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure.  
Minor code may provide more information (Matching credential not found)
%3|1536492505.195|ERROR|rdkafka#producer-11| [thrd:sasl_plaintext://kafka2.dataak.dev:9096/bootstrap]: sasl_plaintext://kafka2.dataak.dev:9096/bootstrap: Failed to initialize SASL authentication: SASL handshake failed (start (-1)): SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (Matching credential not found)
11%2|1536492506.480|LIBSASL|rdkafka#producer-12| [thrd:sasl_plaintext://kafka3.dataak.dev:9096/bootstrap]: sasl_plaintext://kafka3.dataak.dev:9096/bootstrap: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (Matching credential not found)
%3|1536492506.480|FAIL|rdkafka#producer-12| [thrd:sasl_plaintext://kafka3.dataak.dev:9096/bootstrap]: sasl_plaintext://kafka3.dataak.dev:9096/bootstrap: Failed to initialize SASL authentication: SASL handshake failed (start (-1)): SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (Matching credential not found)
%3|1536492506.480|ERROR|rdkafka#producer-12| [thrd:sasl_plaintext://kafka3.dataak.dev:9096/bootstrap]: sasl_plaintext://kafka3.dataak.dev:9096/bootstrap: Failed to initialize SASL authentication: SASL handshake failed (start (-1)): SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure.  Minor code may provide more information (Matching credential not found)

enter image description here 当我同时多次运行‍ php index.php时,这个问题会更多。

这是自然的问题吗? 有办法解决吗?

0 个答案:

没有答案
相关问题