-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathresetEnvironment.sh
executable file
·32 lines (25 loc) · 1.25 KB
/
resetEnvironment.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
#!/bin/bash
## Change to desired working directory (i.e. Kafka install folder)
cd ../kafka_2.12-2.3.0/
## Make sure everything is stopped
bin/kafka-server-stop.sh
sleep 3
bin/zookeeper-server-stop.sh
sleep 3
## Clean temporary folders and empty kafka content (existing messages and topics)
rm -rf /tmp/zookeeper/
rm -rf /tmp/kafka-logs/
## Start servers
bin/zookeeper-server-start.sh config/zookeeper.properties &
sleep 3
bin/kafka-server-start.sh config/server.properties &
sleep 5
## Create necessary topics
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic orders
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic payments
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic shipments
bin/kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic ordersconsistency
echo ''
echo '-----------------------------------------------------------------------------------'
echo '-- Environment clean of messages, you can start services and place order now. ---'
echo '-----------------------------------------------------------------------------------'