Help Center/ MapReduce Service/ User Guide (Ankara Region)/ Troubleshooting/ Using Kafka/ Error "AdminOperationException" Is Displayed When a Kafka Topic Is Deleted
Updated on 2024-11-29 GMT+08:00

Error "AdminOperationException" Is Displayed When a Kafka Topic Is Deleted

Symptom

When running the following command on the Kafka client to set the ACL for a topic, it is found that the ACL cannot be set.

kafka-topics.sh --delete --topic test4 --zookeeper 10.5.144.2:2181/kafka

The error message "ERROR kafka.admin.AdminOperationException: Error while deleting topic test4" is displayed.

Details are as follows:

Error while executing topic command : Error while deleting topic test4
[2017-01-25 14:00:20,750] ERROR kafka.admin.AdminOperationException: Error while deleting topic test4
at 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. Kafka provides a secure access interface. Only users in the kafkaadmin group can delete topics.

Cause Analysis

  1. After the client command is run, the "AdminOperationException" exception is reported.
  2. Run the client command klist to query the current authenticated user.
    [root@10-10-144-2 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

    The test user is used in this example.

  3. Run the id command to query the user group information.
    [root@10-10-144-2 client]# id test
    uid=20032(test) gid=10001(hadoop) groups=10001(hadoop),9998(ficommon),10003(kafka)

Solution

MRS Manager:

  1. Log in to MRS Manager.
  2. Choose System > Manage User.
  3. In the Operation column of the user, click Modify.
  4. Add the user to the kafkaadmin group. Click OK.
  5. Run the id command to query the user group information.

    [root@10-10-144-2 client]# id test
    uid=20032(test) gid=10001(hadoop) groups=10001(hadoop),9998(ficommon),10002(kafkaadmin),10003(kafka)

FusionInsight Manager:

  1. Log in to FusionInsight Manager.
  2. Choose System > Permission > User.
  3. Locate the row that contains the target user, and click Modify.
  4. Add the user to the kafkaadmin group. Click OK.
  5. Run the id command to query the user group information.

    [root@10-10-144-2 client]# id test
    uid=20032(test) gid=10001(hadoop) groups=10001(hadoop),9998(ficommon),10002(kafkaadmin),10003(kafka)