kafka开启kerberos认证

历时两天,断断续续的终于能正常producer和consumer了,记录下。

采用的是ambari,直接按照官方文档部署,需要更改的地方:

1、遇到这个错误:

ERROR Error when sending message to topic test with key: null, value: 3 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback) org.apache.kafka.common.errors.TimeoutException: Expiring 2 record(s) for test-0: 1525 ms has passed since batch creation plus linger time

解决方法:

/kafka-logs/meta.properties中将broker.id=0改成broker.id=1001。

2、consumer报

WARN [console-consumer-67172_hadoop27-1550826107210-f5aa537c-leader-finder-thread]: Failed to find leader for Set(test-0) (kafka.consumer.ConsumerFetcherManager$LeaderFinderThread)
kafka.common.BrokerEndPointNotAvailableException: End point with security protocol SASL_PLAINTEXT not found for broker 1001

解决办法:

consumer语句用这个:

/bin/kafka-console-consumer.sh --zookeeper yourhostname:2181 --topic test --from-beginning --security-protocol PLAINTEXTSASL

顺便生产者的语句是这个:

./bin/kafka-console-producer.sh --broker-list hadoop27:6667 --topic test --security-protocol PLAINTEXTSASL

3、将listeners=PLAINTEXT://localhost:6667 改为PLAINTEXT://yourhostname:6667

你可能感兴趣的:(大数据)