Skip to content

Commit 3563662

Browse files
committed
Added bash script for starting services mongodb and kafka
1 parent 82737d0 commit 3563662

2 files changed

Lines changed: 28 additions & 1 deletion

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ build/
3535
# Environment files
3636
.mvn/
3737
index.html
38-
*.yml
38+
*.yml
39+
log/

start_services.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/bash
2+
3+
KAFKA_LOCATION=/f/kafka/bin
4+
LOG_DIR=$(pwd)
5+
PID_DIR="$LOG_DIR/pids"
6+
7+
echo "Starting services..."
8+
9+
echo "Starting mongodb.."
10+
net start mongodb
11+
12+
mkdir -p "$LOG_DIR/log"
13+
mkdir -p "$PID_DIR"
14+
15+
echo "Starting Kafka Zookeeper..."
16+
cd "$KAFKA_LOCATION"
17+
./zookeeper-server-start.sh ../config/zookeeper.properties > "$LOG_DIR/log/zookeeper.log" 2>&1 &
18+
echo $! > "$PID_DIR/zookeeper.pid"
19+
20+
sleep 10 # Waiting till the zookeeper server is fully started.
21+
22+
echo "Starting Kafka Server..."
23+
./kafka-server-start.sh ../config/server.properties > "$LOG_DIR/log/kafka.log" 2>&1 &
24+
echo $! > "$PID_DIR/kafka.pid"
25+
26+
echo "All services started logs are in $LOG_DIR/log"

0 commit comments

Comments
 (0)