Skip to content

Instantly share code, notes, and snippets.

@ambud
Created August 23, 2016 00:00
Show Gist options
  • Select an option

  • Save ambud/9b5a12a14e982a4df283547f8ceda8b9 to your computer and use it in GitHub Desktop.

Select an option

Save ambud/9b5a12a14e982a4df283547f8ceda8b9 to your computer and use it in GitHub Desktop.
Checks if topology exists and kills it to deploy a new version of the topology
#!/bin/bash
#
# Author: Ambud Sharma
#
set -eu
export STORM_LOC=/tmp/apache-storm-1.0.2
CONFIG=""
if [ ! -z $DEV ]; then
CONFIG=./deploy/configs/dev-parser-topology.config
cp ./deploy/configs/dev-storm.yaml $STORM_LOC/conf/storm.yaml
else
CONFIG=./deploy/configs/prod-parser-topology.config
cp ./deploy/configs/prod-storm.yaml $STORM_LOC/conf/storm.yaml
fi
LIST_T=`$STORM_LOC/bin/storm list`
if [ "$(echo $LIST_T | grep -c "TopologyName" )" -ge 1 ]; then
echo "Kill the existing topology"
$STORM_LOC/bin/storm kill TopologyName -w 10
fi
sleep 12
echo "Deploy the new topology"
$STORM_LOC/bin/storm jar path-to-jar-with-dependencies.jar org.apache.storm.flux.Flux --remote xyz/src/main/resources/topology.yml --filter $CONFIG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment