saketthakare
11/1/2018 - 7:35 AM

Kafka Topic Generation

Commands include- Starting server- Deleting topics- Creating 2 kafka topics post_book and response_topic- Listing topics

# starting server

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties

To start in background
nohup bin/zookeeper-server-start.sh config/zookeeper.properties &
nohup bin/kafka-server-start.sh config/server.properties &

# deleting topics

bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic test
bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic response_topic
bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic 

# creating a topic

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic post_book
bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic response_topic

# listing topics

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

# Insufficient memory for the Java Runtime Environment to continue

export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"

# Kill process on a port

sudo kill `sudo lsof -t -i:9001`