Help Center > > User Guide> MRS Cluster Component Operation Guide> Using Kafka> Managing Kafka Topics

Managing Kafka Topics

Updated at: Apr 28, 2020 GMT+08:00

Scenario

Users can manage Kafka topics on the MRS cluster client to meet service requirements. For clusters with Kerberos authentication enabled, the management permission is required.

Prerequisites

The client has been updated.

Procedure

  1. On the MRS cluster details page, click Components.

    • If the Components tab is not displayed on the cluster details page, complete IAM user synchronization first. (On the Dashboard tab page of the cluster details page, click on the right side of IAM User Sync to synchronize IAM users.)
    • For MRS 1.8.10 or earlier, log in to MRS Manager. For details, see Accessing MRS Manager. Then, choose Services.

  2. Choose ZooKeeper > Instance. Query the IP addresses of the ZooKeeper instances.

    Record the IP address of any ZooKeeper instance.

  3. Log in to the node where the client is installed.

    For example, if you have updated the client on the Master2 node, log in to the Master2 node to use the client. For details, see Using an MRS Client.

  4. Run the following command to switch the user:

    sudo su - omm

  5. Run the following command to switch to the client directory, for example, /opt/client/Kafka/kafka/bin.

    cd /opt/client/Kafka/kafka/bin

  6. Run the following command to configure the environment variables:

    source /opt/client/bigdata_env

  7. If Kerberos authentication is enabled, run the following command to authenticate the user. If Kerberos authentication is disabled, skip this step.

    kinit Kafka username

    For example, kinit admin

  8. Manage Kafka topics using the following commands:

    • Create a topic.

      sh kafka-topics.sh --create --topic Topic name --partitions Number of partitions used by the topic --replication-factor Number of replicas of the topic --zookeeper IP address of the node where the ZooKeeper instance is located:clientPort/kafka

    • Delete a topic.

      sh kafka-topics.sh --delete --topic Topic name --zookeeper IP address of the node where the ZooKeeper instance is located:clientPort/kafka

    • The number of topic partitions or topic backups cannot exceed the number of Kafka instances.
    • By default, clientPort of ZooKeeper is 2181
    • There are three ZooKeeper instances. Use the IP address of any one.
    • For details about managing messages in Kafka topics, see Managing Messages in Kafka Topics.

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel