-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.sh
executable file
·38 lines (33 loc) · 1.07 KB
/
scripts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
lines=(`cat "config.txt"`)
route=${lines[1]}
if [ $1 == "help" ]; then
echo "Commands available"
echo "list, create, listen, write, stop, collector"
fi
if [ $1 == "list" ]; then
echo "Listing topics. No params"
${lines[1]}/bin/kafka-topics.sh --list --zookeeper localhost:2181
fi
if [ $1 == "create" ]; then
echo "Creating topic. Param1*(topic)"
${lines[1]}/bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 2 --topic $2
fi
if [ $1 == "listen" ]; then
echo "Listening one topic. Param1*(topic)"
${lines[1]}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic $2 --from-beginning
fi
if [ $1 == "write" ]; then
echo "Writing in one topic. Param1*(topic)"
${lines[1]}/bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic $2
fi
if [ $1 == "stop" ]; then
echo "Stopping servers"
${lines[1]}/bin/kafka-server-stop.sh
${lines[3]}/bin/stop-hbase.sh
fi
if [ $1 == "collector" ]; then
echo "Running server spring collector"
cd collector
eval "./mvnw spring-boot:run"
fi