This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
galaxy-deployment-k8s/storm/topo/storm_topology/completion/startall.sh
2020-05-25 16:48:37 +08:00

35 lines
1.2 KiB
Bash
Executable File

#! /bin/bash
#启动storm任务脚本
#任务jar所在目录
BASE_DIR=$2
#jar name
JAR_NAME='log-stream-completion.jar'
#nimbus ip
LOCAL_IP=$3
cd $BASE_DIR
function read_dir(){
for file in `ls $1` #注意此处这是两个反引号,表示运行系统命令
do
if [ -d $1"/"$file ] #注意此处之间一定要加上空格,否则会报错
then
read_dir $1"/"$file
else
jar -xvf $BASE_DIR/$JAR_NAME service_flow_config.properties
cat $1$file > $BASE_DIR/service_flow_config.properties
sed -i 's/ipaddress/'$LOCAL_IP'/' $BASE_DIR/service_flow_config.properties
jar -uvf $BASE_DIR/$JAR_NAME service_flow_config.properties
docker run -it --rm -v $BASE_DIR/$JAR_NAME:/$JAR_NAME --env ZK_IPARR=$LOCAL_IP --env NIMBUS_IP=$LOCAL_IP --env ZK_PORTS=2182 --net host storm:1.0.2 /opt/apache-storm-1.0.2/start_storm.sh storm jar /$JAR_NAME cn.ac.iie.topology.LogFlowWriteTopology $file remote
fi
done
}
if [ $# != 3 ];then
echo "usage: ./startall.sh [Configuration path] [Path of jar] [nimbus ip]"
exit 1
fi
#读取第一个参数 为配置文件目录名称
read_dir $1