Created
July 5, 2018 18:06
-
-
Save ravi72munde/964a0a4c152793be98e1187f453f2a24 to your computer and use it in GitHub Desktop.
Kafka Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Start zookeeper : | |
## started with nohup and output directed to zookper-logs.log | |
nohup bin/zookeeper-server-start config/zookeeper.properties > ~/workspace/logs/zookper-logs.log & | |
#Stop zookeeper | |
bin/zookeeper-server-stop | |
#stop a service(connect, schema register, server etc) using conflunet packge | |
bin/confluent-stop <service> | |
##Start Schema Registry | |
nohup bin/schema-registry-start etc/schema-registry/schema-registry.properties > ~/workspace/logs/schem-registry.log & | |
## Start kafka server with 3 nodes. Each node config is modified to have different port and broker ids: | |
#borker 0 | |
sudo nohup ./bin/kafka-server-start config/server-config/server.properties > ~/workspace/logs/kafka-log.log & | |
#broker 1 | |
sudo nohup ./bin/kafka-server-start config/server-config/server-1.properties > ~/workspace/logs/kafka-log-1.log & | |
#borker 2 | |
sudo nohup ./bin/kafka-server-start config/server-config/server-2.properties > ~/workspace/logs/kafka-log-2.log & | |
#check if brokers are running | get running brokers with ids | |
echo dump | nc localhost 2181 | grep brokers | |
## Create topics | |
bin/kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 3 --topic <topic_name> | |
## List topics | |
bin/kafka-topics --list --zookeeper localhost:2181 | |
` | |
## Describe topics | |
bin/kafka-topics --describe --zookeeper localhost:2181 --topic <topic_name> | |
## View message from topic ##-from-beginning to read messages from start | |
bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic <topic_name> --from-beginning | |
#Find PID using a particular port port | |
$ sudo netstat -nlp | grep :<port_no> | |
## Start connector | |
./bin/connect-standalone config/worker.properties config/<connector>.properties | |
## Add custom jar to classpath for connect | |
export CLASSPATH="/home/weblogic/workspace/jsconnect-out/gson-2.8.5.jar":"/home/weblogic/workspace/jsconnect-out/jsonconnect-1.0.jar":"${CLASSPATH}" | |
export CLASSPATH="/home/weblogic/workspace/jsconnect-out/uber-connect.jar":"${CLASSPATH}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment