Hello, everyone!
I will share with you how to deal with the problem of error message stating "AdminOperationException" is displayed when a kafka topic fails to be deleted.
Symptom
When running the following command on the Kafka client to set the access control list (ACL), it is found that topic ACL cannot be set.
kafka-topics.sh --delete --topic test4 --zookeeper 10.5.X.X:24002/kafka
Error message stating "ERROR kafka.admin.AdminOperationException: Error while deleting topic test4" is displayed.
The following describes the message details.
Error while executing topic command: Error while deleting topic test4[2017-01-25 06:00,750] ERROR kafka.admin.AdminOperationException: Error while deleting topic test4at kafka.admin.TopicCommand$$anonfun$deleteTopic$1.apply(TopicCommand.scala:177)at kafka.admin.TopicCommand$$anonfun$deleteTopic$1.apply(TopicCommand.scala:162)at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)at kafka.admin.TopicCommand$.deleteTopic(TopicCommand.scala:162)at kafka.admin.TopicCommand$.main(TopicCommand.scala:68)at kafka.admin.TopicCommand.main(TopicCommand.scala)(kafka.admin.TopicCommand$)
Possible Causes
The user does not belong to the kafkaadmin group.
Fault Locating
Run the Kafka client command to record the AdminOperationException exception.
Kafka provides secure access interfaces since C60SPC200, therefore, only users in the kafkaamdin group are allowed to delete topics.
Run the klist command to query the currently authenticated user.
[root@10-10-X-X client]# klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: test@HADOOP.COM
Valid starting Expires Service principal
01/25/17 11:06:48 01/26/17 11:06:45 krbtgt/HADOOP.COM@HADOOP.COM
It can be seen that the currently authenticated user is test.
Run the id command to query the user group information.
[root@10-10-X-X client]# id testuid=20032(test) gid=10001(hadoop) groups=10001(hadoop),9998(ficommon),10003(kafka)
Solution
Add the user to the kafkaadmin group.
Run the id command to query the user group information.
[root@10-10-X-X client]# id testuid=20032(test) gid=10001(hadoop) groups=10001(hadoop),9998(ficommon),10002(kafkaadmin),10003(kafka)
We warmly welcome you to enjoy our community!