1. Install Kafka
KAFKA_HOME
is the Kafka installation directory. 2. Start ZooKeeper
$KAFKA_HOME/bin
directory. ./zookeeper-server-start.sh config/zookeeper.properties
3. Start the Kafka server
$KAFKA_HOME/bin
Directory. ./kafka-server-start.sh config/server.properties
4. Create a topic
$KAFKA_HOME/bin
directory. ./kafka-topics.sh --create --topic my-topic --partitions 1 --replication-factor 1
5. Send a message
$KAFKA_HOME/bin
directory. ./kafka-console-producer.sh --topic my-topic --message "Hello, world!"
6. Consume messages
$KAFKA_HOME/bin
directory. ./kafka-console-consumer.sh --topic my-topic --from-beginning
7. Query the version
$KAFKA_HOME/bin
directory. ./kafka-version.sh
Sample output
kafka-version.sh: version: 2.8.0 kafka-version: 2.8.0 kafka-storage: 2.8.0 kafka-clients: 2.8.0 kafka-streams: 2.8.0 kafka-connect: 2.8.0 kafka-admin: 2.8.0 kafka-tools: 2.8.0
The above is the detailed content of A step-by-step guide to learning to use Kafka version queries. For more information, please follow other related articles on the PHP Chinese website!