Validate Kafka
Use the following procedure to verify Kafka installation and configuration:
![]() | Note |
|---|---|
Verify that ZooKeeper is running before starting Kafka and validating the installation. |
Start the Kafka Service:
su kafka"/usr/hdp/current/kafka-broker/bin/kafka start"Run the following command to start the Kafka cluster:
<KAFKA_INSTALL_DIR>/bin/kafka start config/server.propertiesRun 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 testThe 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".Run the following command to send a test message:
<KAFKA_INSTALL_DIR>/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testYou should see your test message, for example:
This is a message.![[Note]](../common/images/admon/note.png)
Note To return to the command prompt after sending the test message, type Ctrl + C.
Run the following command to receive the test message:
<KAFKA_INSTALL_DIR>/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic test --from-beginningYou should see your test message:
This is a message.

