Help Center/ MapReduce Service/ User Guide (Paris Region)/ Troubleshooting/ Using Kafka/ When a Kafka Topic Fails to Be Created, "NoAuthException" Is Displayed
Updated on 2024-10-11 GMT+08:00

When a Kafka Topic Fails to Be Created, "NoAuthException" Is Displayed

Symptom

When running the following command on the Kafka client to create topics, it is found that the topics cannot be created.

kafka-topics.sh --create --zookeeper 192.168.234.231:2181/kafka --replication-factor 1 --partitions 2 --topic test

Error messages "NoAuthException" and "KeeperErrorCode = NoAuth for /config/topics" are displayed.

Details are as follows:

Error while executing topic command org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /config/topics
org.I0Itec.zkclient.exception.ZkException: org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /config/topics
 at org.I0Itec.zkclient.exception.ZkException.create(ZkException.java:68)
 at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:685)
 at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
 at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:213)
 at kafka.utils.ZkUtils$.createParentPath(ZkUtils.scala:215)
 at kafka.utils.ZkUtils$.updatePersistentPath(ZkUtils.scala:338)
 at kafka.admin.AdminUtils$.writeTopicConfig(AdminUtils.scala:247)

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 "NoAuthException" exception is reported.
    Error while executing topic command org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /config/topics
    org.I0Itec.zkclient.exception.ZkException: org.apache.zookeeper.KeeperException$NoAuthException: KeeperErrorCode = NoAuth for /config/topics
     at org.I0Itec.zkclient.exception.ZkException.create(ZkException.java:68)
     at org.I0Itec.zkclient.ZkClient.retryUntilConnected(ZkClient.java:685)
     at org.I0Itec.zkclient.ZkClient.create(ZkClient.java:304)
     at org.I0Itec.zkclient.ZkClient.createPersistent(ZkClient.java:213)
     at kafka.utils.ZkUtils$.createParentPath(ZkUtils.scala:215)
     at kafka.utils.ZkUtils$.updatePersistentPath(ZkUtils.scala:338)
     at kafka.admin.AdminUtils$.writeTopicConfig(AdminUtils.scala:247)
  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.
  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)