Skip to content

Commit

Permalink
feat: 新增kafka集群启动脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
TomShiDi committed Mar 12, 2024
1 parent a33496d commit c42e657
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kafka-demo/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.tomshidi</groupId>
<artifactId>demo</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>kafka-demo</artifactId>
<name>kafka-demo</name>
</project>
26 changes: 26 additions & 0 deletions kafka-demo/src/main/resources/kafka.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
# 1.判断参数个数
if [[ $# != 1 ]];then
echo -e "请输入参数:\nstart 启动kafka集群;\nstop 关闭kafka集群" && exit
fi

# 2.执行
case $1 in
"start")
for host in node1 node2 node3
do
echo "========== $host 启动kafka集群 =========="
ssh $host "kafka-server-start.sh -daemon /opt/server/kafka/config/server.properties"
done
;;
"stop")
for host in node1 node2 node3
do
echo "========== $host 停止kafka集群 =========="
ssh $host "kafka-server-stop.sh"
done
;;
*)
echo -e "请输入参数:\nstart 启动kafka集群;\nstop 关闭kafka集群"
;;
esac
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<module>zookeeper-demo</module>
<module>hadoop-demo</module>
<module>flume-demo</module>
<module>kafka-demo</module>
</modules>
<parent>
<groupId>org.springframework.boot</groupId>
Expand Down

0 comments on commit c42e657

Please sign in to comment.