Skip to content

Instantly share code, notes, and snippets.

@diegoicosta
Created July 11, 2017 12:38
Show Gist options
  • Save diegoicosta/6d7a6e99b5f8a8142bebe79800130fb5 to your computer and use it in GitHub Desktop.
Save diegoicosta/6d7a6e99b5f8a8142bebe79800130fb5 to your computer and use it in GitHub Desktop.
#KAFKA ALIAS
alias k-zookeeper-start='~/development/servers/confluent/./bin/zookeeper-server-start ~/development/servers/confluent/etc/kafka/zookeeper.properties'
alias k-kafka-start='~/development/servers/confluent/./bin/kafka-server-start ~/development/servers/confluent/etc/kafka/server.properties'
alias k-kafka-rest-start='~/development/servers/confluent/./bin/kafka-rest-start'
alias k-kafka-rest-stop='~/development/servers/confluent/./bin/kafka-rest-stop'
alias k-register-start='~/development/servers/confluent/./bin/schema-registry-start ~/development/servers/confluent/etc/schema-registry/schema-registry.properties'
alias k-list-topics='~/development/servers/confluent/./bin/kafka-topics --list --zookeeper localhost:2181'
alias k-create-topic='~/development/servers/confluent/./bin/kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 5 --topic '
alias k-del-topic='~/development/servers/confluent/./bin/kafka-topics --zookeeper localhost:2181 --delete --topic '
show_topic() {
~/development/servers/confluent/./bin/kafka-console-consumer \
--bootstrap-server localhost:9092 \
--topic $1 --property print.key=true \
--property key.separator=, \
--from-beginning
}
alias k-consume-topic=show_topic
show_topic_avro() {
~/development/servers/confluent/./bin/kafka-avro-console-consumer \
--topic $1 \
--bootstrap-server localhost:9092 \
--property print.value=true \
--from-beginning \
--property schema.registry.url="http://localhost:8081"
}
alias k-consume-topic-avro=show_topic_avro
send_to_topic() {
echo "$1" | ~/development/servers/confluent/./bin/kafka-console-producer \
--broker-list localhost:9092 \
--topic $2
}
alias k-sent-to=send_to_topic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment