hi,when i use rdkafka library in my project ,it is report some error;
my os is win10 ,
PHP Version 7.1.9,
rdkafka Version 3.0.5
librdkafka version (runtime) 0.9.1
librdkafka version (build) 0.9.1.0
this is my code
date_default_timezone_set('PRC');
$conf = new \RdKafka\Conf();
$conf->set('api.version.request', 'true');
$conf->set('ssl.ca.location', $this->kafka_setting['ca_file']);
$conf->set('message.send.max.retries', 5);
$conf->set('security.protocol', 'SASL_SSL');
$conf->set('sasl.mechanisms', 'PLAIN');
$conf->set('sasl.username', $this->kafka_setting['sasl_plain_username']);
$conf->set('sasl.password', $this->kafka_setting['sasl_plain_password']);
$rk = new \RdKafka\Producer($conf);
$rk->setLogLevel(LOG_DEBUG);
$rk->addBrokers($this->kafka_setting['bootstrap_servers']);
$topic_conf = new \RdKafka\TopicConf();
$topic = $rk->newTopic($this->kafka_setting['topic_name'],$topic_conf);
$a = $topic->produce(RD_KAFKA_PARTITION_UA, 0, "Message hello kafka");
$rk->poll(0);
while ($rk->getOutQLen() > 0) {
$rk->poll(50);
}
echo "send succ" . PHP_EOL;
report error:
No such configuration property: "sasl.mechanisms"|No such configuration property: "sasl.username"|No such configuration property: "sasl.password"|Invalid value for configuration property "security.protocol"
i don`t kown why i run a official demo code and it report this error; can you help me. thank you first;
I meet the same problem, and i set 'security.protocol' = 'sasl_plaintext'.The
problem solved. you can try this. : )
@mgckid 你好,我也遇到了这个问题,请问有解决方案吗?
@swonzhang ,暂时无解,你是不是连接阿里云的kafaka呀,如果是阿里云的可以用他官方的sdk
can you found same issue ?
As @lilinhan provided the solution, i think this can be closed @mgckid @arnaud-lb
@swonzhang ,暂时无解,你是不是连接阿里云的kafaka呀,如果是阿里云的可以用他官方的sdk
阿里云的kafka 的sdk 是java语言的, 有php 语言的推荐么?
@Rock2018 this should work now without problem, check this example for guidance on settings
Most helpful comment
I meet the same problem, and i set 'security.protocol' = 'sasl_plaintext'.The
problem solved. you can try this. : )