Installing HDP Manually
Also available as:
PDF
loading table of contents...

Validate Kafka

Use the following procedure to verify Kafka installation and configuration:

[Note]Note

Verify that ZooKeeper is running before starting Kafka and validating the installation.

  1. Start the Kafka Service:

    su kafka

    "/usr/hdp/current/kafka-broker/bin/kafka start"

  2. Run the following command to start the Kafka cluster:

    <KAFKA_INSTALL_DIR>/bin/kafka start config/server.properties

  3. Run the following command to create a test Kafka topic:

    <KAFKA_INSTALL_DIR>/bin/kafka-topics.sh --zookeeper localhost:2181 --create --topic --replication-factor 1 --partitions 1 --topic test

    The value of --replication-factor must match the number of Kafka servers in the cluster. You should see the following output if Kafka is installed correctly: Created topic "test".

  4. Run the following command to send a test message:

    <KAFKA_INSTALL_DIR>/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test

    You should see your test message, for example:

    This is a message.

    [Note]Note

    To return to the command prompt after sending the test message, type Ctrl + C.

  5. Run the following command to receive the test message:

    <KAFKA_INSTALL_DIR>/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginning

    You should see your test message:

    This is a message.