List all kafka topics

后端 未结 15 723
谎友^
谎友^ 2020-12-24 00:13

I\'m using kafka 0.10 without zookeeper. I want to get kafka topics list. This command is not working since we\'re not using zookeeper: <

相关标签:
15条回答
  • 2020-12-24 00:40

    Using Confluent's REST Proxy API:

    curl -X GET -H "Accept: application/vnd.kafka.v2+json" localhost:8082/topics 
    

    where localhost:8082 is Kafka Proxy address.

    0 讨论(0)
  • 2020-12-24 00:41

    You need to start the zookeeper server first. So first go to kafka/bin/windows and run

    zookeeper-server-start.bat ../../config/zookeeper.properties
    

    then in the same folder with a new cmd windows start the kafka servers by running

    kafka-server-start.bat ../../config/server.properties
    

    Note: if you starting it for the first time then there are certain changes to be made in these files

    then inside kafka/bin/windows run

    kafka-topics.bat --zookeeper localhost:2181 --list
    

    to list down all the topics existing.

    0 讨论(0)
  • 2020-12-24 00:45

    The Kafka clients no longer require zookeeper but the Kafka servers do need it to operate.

    You can get a list of topics with the new AdminClient API but the shell command that ship with Kafka have not yet been rewritten to use this new API.

    The other way to use Kafka without Zookeeper is to use a SaaS Kafka-as-a-Service provider such as Confluent Cloud so you don’t see or operate the Kafka brokers (and the required backend Zookeeper ensemble).

    For example on Confluent Cloud you would just use the following zookeeper free CLI command:

    ccloud topic list
    
    0 讨论(0)
  • 2020-12-24 00:45

    Please use kafka-topics.sh --list --bootstrap-server localhost:9092 to list down all topics

    0 讨论(0)
  • 2020-12-24 00:47

    to see that topic if we run the list topic command:

    $ bin/kafka-topics.sh --list --zookeeper localhost:2181

    To check if the data is landing in Kafka:

    $ bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic twitterstream --from-beginning

    0 讨论(0)
  • 2020-12-24 00:48

    You have a stale version of the package with commands that no longer accept zookeeper but rather bootstrap-server as the connection. Confluent will then connect with Zookeeper internally.

    https://www.confluent.io/download/ (5.3 or greater)

    0 讨论(0)
提交回复
热议问题