In this article, we will explain simple Kafka commands for beginners and experienced professionals in the present market in IT industry.
At present market Kafka technology is one of the tremendous technology for fortune 500 companies to utilize recently. For Hadoop admins are migrate into Kafka admin because lot of project migrate from Hadoop environment to Kafka environment.
Basic Kafka Commands:
How to start Kafka service through CLI using server properties file like below.
Kafka server start:
How to stop Kafka service through CLI using server properties file like below.
Kafka server stop:
How to create topic in Kafka environment:
Kafka topic creation:
kafka-topics --create --zookeeper Zokeeper_host:2181 --topic topic_name -- replication-factor3 (based on you're requirement) --partitions 6(based on you're requirement)
How to describe Kafka topic name using describe command.
Kafka topic describe:
kafka-topics --describe --zookeeper Zokeeper_host :2181 --topic topic_name
How to get list of topics from Kafka broker.
Kafka topics list:
kafka-topics --list --zookeeper Zokeeper_host:2181
If you want to specific one topic list then try to execute below command.
kafka-topics --list --zookeeper Zokeeper_host:2181 | grep topic_name
How to delete Kafka topics from broker.
Kafka topics delete :
In this command little bit attention, if it is deleted the topic data is cleared. You need to approvals from mangers and then delete it. Else you need to do topic retention, I will share another post on that one. I will explain Kafka topic retention with time limit.
kafka-topics --delete --zookeeper Zokeeper_host:2181 --topic topic_name
The above Kafka commands are very simple to learn and useful for Kafka developers and admins. Kafka server start and stop command is standard for professionals sometimes systemctl are also useful but many cases using server.properties file command.
Basically, here we provided zookeeper host. Some of the commands will provide bootstrap server name instead of ZK host in the above commands.