├── README.md ├── jq-linux64 ├── killozap.sh └── killozap2.sh /README.md: -------------------------------------------------------------------------------- 1 | Destroys (with extreme prejudice) consul or etcd cluster persistent state for a given cf deployment for when those clusters have lost quorum. 2 | 3 | Assumes the PCF convention where 4 | * consul server jobs have the pattern "consul_server" 5 | * etcd server jobs have the pattern "etcd_server" 6 | * diego BBS have "diego_database" job name patterns, 7 | * diego brain have "diego_brain" job patterns, 8 | * and cells have "diego_cell" job patterns. 9 | 10 | Also assumes that you can't predict which consul agent thinks its the leader, so it's best to nuke or restart them all. 11 | 12 | **Usage: killozap.sh [etcd|bbs|consul-all|consul-serversconsul-restart|brain-restart|cells|ripley]** 13 | 14 | **etcd** argument will 15 | * find all etcd_server jobs' etcd processes in a bosh deployment 16 | * monit stop etcd 17 | * rm -rf /var/vcap/store/etcd 18 | * restart all etcd servers. 19 | 20 | **consul-servers** argument will 21 | * find all consul_agent processes in a bosh deployment (across consul_server jobs only) 22 | * monit stop consul_agent 23 | * rm -rf /var/vcap/store/consul_agent 24 | * restart all consul_agent processes 25 | 26 | **consul-all** argument will 27 | * find all consul_agent processes in a bosh deployment (across ALL jobs) 28 | * monit stop consul_agent 29 | * rm -rf /var/vcap/store/consul_agent 30 | * restart all consul_agent processes 31 | 32 | **consul-restart** argument will 33 | * restart all consul_agent processes (across all jobs) 34 | 35 | **brain-restart** argument will 36 | * restart all processes across all diego_brain jobs 37 | 38 | **cells** argument will 39 | * find all diego_cell jobs' consul_agent processes in a bosh deployment 40 | * monit stop consul_agent 41 | * rm -rf /var/vcap/store/consul_agent 42 | * restart all consul_agent servers. 43 | 44 | **bbs** argument will 45 | * find all diego_database etcd processes in a bosh deployment 46 | * monit stop etcd 47 | * rm -rf /var/vcap/store/etcd 48 | * restart all etcd processes 49 | 50 | **ripley** argument will nuke the site from orbit (aka. all of the above). 51 | 52 | *"The designer of the gun had clearly not been instructed to beat about the bush. 'Make it evil,' he'd been told. 'Make it totally clear that this gun has a right end and a wrong end. Make it totally clear to anyone standing at the wrong end that things are going badly for them. If that means sticking all sort of spikes and prongs and blackened bits all over it, then so be it. This is not a gun for hanging over the fireplace or sticking in the umbrella stand, it is a gun for going out and making people miserable with.'"* - Douglas Adams 53 | 54 | 55 | -------------------------------------------------------------------------------- /jq-linux64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svrc/killozap-cf/f026cd209b4d173bdfcbe81f00515ef41e5df0a5/jq-linux64 -------------------------------------------------------------------------------- /killozap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Hunts for consul or etcd instances, shuts them all down, nukes their storage, the restarts them 3 | # Presumes PCF job name patterns 4 | # Useful for quorum loss 5 | 6 | if [ -f /home/tempest-web/tempest/web/vendor/bosh/Gemfile ]; 7 | then 8 | export BUNDLE_GEMFILE=/home/tempest-web/tempest/web/vendor/bosh/Gemfile 9 | export COMMAND="bundle exec bosh" 10 | elif [ -d /home/tempest-web ]; 11 | then 12 | export BUNDLE_GEMFILE=/home/tempest-web/tempest/web/bosh.Gemfile 13 | export COMMAND="bundle exec bosh" 14 | else 15 | export COMMAND="bosh" 16 | fi 17 | 18 | if [[ ($1 == "consul-all") || ($1 == "consul-servers") || ($1 == "consul-restart") || ($1 == "brain-restart") || ($1 == "etcd" ) || ($1 == "bbs" ) || ($1 == "ripley") || ($1 == "cells") ]] 19 | then 20 | echo "Kill-o-Zapping your current CF deployment... " 21 | else 22 | echo "Usage: $0 [consul-all | consul-restart | brain-restart | bbs | etcd | cells | ripley]" 23 | echo "" 24 | echo "consul-all will stop all consul_agent processes globally, delete /var/vcap/store/consul_agent/* recursively, and restart them" 25 | echo "consul-servers will stop all consul_server consul_agent processes, delete /var/vcap/store/consul_agent/* recursively, and restart them" 26 | echo "consul-restart will restart all consul_agent processes globally" 27 | echo "brain-restart will restart all diego brain processes, may be needed after a consul reset" 28 | echo "bbs will stop all diego bbs etcd processes, delete /var/vcap/store/etcd/* recursively, and restart them" 29 | echo "etcd will stop all non-diego-bbs etcd job processes, delete /var/vcap/store/etcd/* recursively, and restart them" 30 | echo "cells will stop all diego_cell consul_agent job processes, delete /var/vcap/store/consul_agent/* recursively, and restart them" 31 | echo "ripley will nuke the site from orbit; aka stop, delete, restart all etcd and consul_agent processes" 32 | exit 1 33 | fi 34 | 35 | 36 | stopProcesses() { 37 | for x in $jobVMs; do 38 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 39 | instanceId=$(echo $x | awk -F "/" '{ print $2 }'| awk -F '(' '{ print $1 }') 40 | if [ -z $instanceId ]; then 41 | continue 42 | fi 43 | if [ $1 == "all" ]; then 44 | echo Stopping all processes: $jobId Instance: $instanceId 45 | $COMMAND ssh $jobId $instanceId "sudo -s /var/vcap/bosh/bin/monit stop all" 46 | continue 47 | fi 48 | processId=$(echo $x | awk -F "," '{ print $2 }') 49 | if [ -z $processId ]; then 50 | continue 51 | fi 52 | if [ $processId = $1 ]; then 53 | echo Stopping: $jobId Instance: $instanceId Process $processId 54 | $COMMAND ssh $jobId $instanceId "sudo -s /var/vcap/bosh/bin/monit stop $processId" 55 | fi 56 | done 57 | } 58 | 59 | restartProcesses() { 60 | for x in $jobVMs; do 61 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 62 | instanceId=$(echo $x | awk -F "/" '{ print $2 }'| awk -F '(' '{ print $1 }') 63 | if [ -z $instanceId ]; then 64 | continue 65 | fi 66 | if [ "all" == $1 ]; then 67 | echo Restarting all processes: $jobId Instance: $instanceId 68 | $COMMAND ssh $jobId $instanceId "sudo -s /var/vcap/bosh/bin/monit restart all" 69 | continue 70 | fi 71 | processId=$(echo $x | awk -F "," '{ print $2 }') 72 | if [ -z $processId ]; then 73 | continue 74 | fi 75 | if [ $processId = $1 ]; then 76 | echo Restarting: $jobId Instance: $instanceId Process $processId 77 | $COMMAND ssh $jobId $instanceId "sudo -s /var/vcap/bosh/bin/monit restart $processId" 78 | fi 79 | done 80 | } 81 | 82 | startProcesses() { 83 | for x in $jobVMs; do 84 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 85 | instanceId=$(echo $x | awk -F "/" '{ print $2 }'| awk -F '(' '{ print $1 }') 86 | if [ -z $instanceId ]; then 87 | continue 88 | fi 89 | if [ "all" == $1 ]; then 90 | echo Starting all processes: $jobId Instance: $instanceId 91 | $COMMAND ssh $jobId $instanceId "sudo -s /var/vcap/bosh/bin/monit start all" 92 | continue 93 | fi 94 | processId=$(echo $x | awk -F "," '{ print $2 }') 95 | if [ -z $processId ]; then 96 | continue 97 | fi 98 | if [ $processId = $1 ]; then 99 | echo Starting: $jobId Instance: $instanceId Process $processId 100 | $COMMAND ssh $jobId $instanceId "sudo -s /var/vcap/bosh/bin/monit start $processId" 101 | echo Sleeping 30 seconds to wait for process to come up 102 | sleep 30 103 | fi 104 | done 105 | } 106 | 107 | 108 | nukeProcesses() { 109 | for x in $jobVMs; do 110 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 111 | instanceId=$(echo $x | awk -F "/" '{ print $2 }'| awk -F '(' '{ print $1 }') 112 | if [ -z $instanceId ]; then 113 | continue 114 | fi 115 | processId=$(echo $x | awk -F "," '{ print $2 }') 116 | if [ -z $processId ]; then 117 | continue 118 | fi 119 | if [ $processId = $1 ]; then 120 | echo Deleting: $jobId Instance: $instanceId Directory /var/vcap/store/$processId 121 | $COMMAND ssh $jobId $instanceId "sudo -s rm -rf /var/vcap/store/$processId/*" 122 | fi 123 | done 124 | } 125 | 126 | if [ $1 == "brain-restart" ]; then 127 | jobVMs=$($COMMAND instances | awk -F '|' '{ print $2 }' | grep diego_brain) 128 | restartProcesses all 129 | fi 130 | 131 | 132 | if [ $1 == "consul-all" ]; then 133 | allJobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }') 134 | jobVMs=$allJobVMs 135 | stopProcesses consul_agent 136 | nukeProcesses consul_agent 137 | 138 | # Start the consul server cluster first. 139 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }' | grep consul_server) 140 | startProcesses consul_agent 141 | jobVMs=$allJobVMs 142 | startProcesses consul_agent 143 | fi 144 | 145 | if [ $1 == "consul-servers" ]; then 146 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }' | grep consul_server) 147 | stopProcesses consul_agent 148 | nukeProcesses consul_agent 149 | echo Waiting 30 seconds for processes to finish exiting 150 | sleep 30 151 | startProcesses consul_agent 152 | fi 153 | 154 | if [ $1 == "consul-restart" ]; then 155 | allJobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }') 156 | jobVMs=$allJobVMs 157 | stopProcesses consul_agent 158 | 159 | # Start the consul server cluster first. 160 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }' | grep consul_server) 161 | startProcesses consul_agent 162 | jobVMs=$allJobVMs 163 | startProcesses consul_agent 164 | fi 165 | 166 | if [ $1 == "etcd" ]; then 167 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }'| grep etcd_server) 168 | stopProcesses etcd 169 | nukeProcesses etcd 170 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }'| grep etcd_tls_server) 171 | stopProcesses etcd 172 | nukeProcesses etcd 173 | echo Waiting 30 seconds for processes to finish exiting 174 | sleep 30 175 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }'| grep etcd_server) 176 | startProcesses etcd 177 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }'| grep etcd_tls_server) 178 | startProcesses etcd 179 | fi 180 | 181 | if [ $1 == "cells" ]; then 182 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }'| grep diego_cell) 183 | stopProcesses consul_agent 184 | nukeProcesses consul_agent 185 | startProcesses consul_agent 186 | fi 187 | 188 | if [ $1 == "bbs" ]; then 189 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }'| grep diego_database) 190 | stopProcesses etcd 191 | nukeProcesses etcd 192 | echo Waiting 30 seconds for processes to finish exiting 193 | sleep 30 194 | startProcesses etcd 195 | fi 196 | 197 | if [ $1 == "ripley" ]; then 198 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }') 199 | allJobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }') 200 | jobVMs=$allJobVMs 201 | stopProcesses consul_agent 202 | nukeProcesses consul_agent 203 | 204 | # Start the consul server cluster first. 205 | jobVMs=$($COMMAND instances --ps | awk -F "|" 'RS="\\+\\-\\-" {gsub(/ /, "", $0); for (i=2; i<= NF; i+=6) printf "%s\n", (i>2) ? $2 "," $i : "" }' | grep consul_server) 206 | startProcesses consul_agent 207 | jobVMs=$allJobVMs 208 | startProcesses consul_agent 209 | stopProcesses etcd 210 | nukeProcesses etcd 211 | echo Waiting 30 seconds for processes to finish exiting 212 | sleep 30 213 | startProcesses etcd 214 | jobVMs=$($COMMAND instances | awk -F '|' '{ print $2 }' | grep diego_brain) 215 | restartProcesses all 216 | fi 217 | 218 | -------------------------------------------------------------------------------- /killozap2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # New v2.0! Only change is it uses bosh v2cli and now requires jq. 3 | # Hunts for consul or etcd instances, shuts them all down, nukes their storage, the restarts them 4 | # Presumes PCF job name patterns 5 | # Useful for quorum loss 6 | 7 | export COMMAND=bosh 8 | 9 | if [[ ($1 == "consul-all") || ($1 == "consul-servers") || ($1 == "consul-restart") || ($1 == "brain-restart") || ($1 == "etcd" ) || ($1 == "bbs" ) || ($1 == "ripley") || ($1 == "cells") ]] 10 | then 11 | echo "Kill-o-Zapping your current CF deployment... " 12 | else 13 | echo "Usage: $0 [consul-all | consul-restart | brain-restart | bbs | etcd | cells | ripley]" 14 | echo "" 15 | echo "Make sure your BOSH environment variables are all set! BOSH_DEPLOYMENT , BOSH_ENVIRONMENT, BOSH_CA_CERT at minimum" 16 | echo "" 17 | echo "consul-all will stop all consul_agent processes globally, delete /var/vcap/store/consul_agent/* recursively, and restart them" 18 | echo "consul-servers will stop all consul_server consul_agent processes, delete /var/vcap/store/consul_agent/* recursively, and restart them" 19 | echo "consul-restart will restart all consul_agent processes globally" 20 | echo "brain-restart will restart all diego brain processes, may be needed after a consul reset" 21 | echo "bbs will stop all diego bbs etcd processes, delete /var/vcap/store/etcd/* recursively, and restart them" 22 | echo "etcd will stop all non-diego-bbs etcd job processes, delete /var/vcap/store/etcd/* recursively, and restart them" 23 | echo "cells will stop all diego_cell consul_agent job processes, delete /var/vcap/store/consul_agent/* recursively, and restart them" 24 | echo "ripley will nuke the site from orbit; aka stop, delete, restart all etcd and consul_agent processes" 25 | exit 1 26 | fi 27 | 28 | 29 | stopProcesses() { 30 | for x in $jobVMs; do 31 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 32 | instanceId=$(echo $x | awk -F "/" '{ print $2 }' | awk -F ',' '{ print $1 }') 33 | if [ $1 == "all" ]; then 34 | echo Stopping all processes: $jobId Instance: $instanceId 35 | $COMMAND ssh $jobId/$instanceId "sudo -s /var/vcap/bosh/bin/monit stop all" 36 | continue 37 | fi 38 | processId=$(echo $x | awk -F "," '{ print $2 }') 39 | if [ -z $processId ]; then 40 | continue 41 | fi 42 | if [ $processId = $1 ]; then 43 | echo Stopping: $jobId Instance: $instanceId Process $processId 44 | $COMMAND ssh ${jobId}/${instanceId} "sudo -s /var/vcap/bosh/bin/monit stop $processId" 45 | fi 46 | done 47 | } 48 | 49 | restartProcesses() { 50 | for x in $jobVMs; do 51 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 52 | instanceId=$(echo $x | awk -F "/" '{ print $2 }' | awk -F ',' '{ print $1 }') 53 | if [ -z $instanceId ]; then 54 | continue 55 | fi 56 | if [ "all" == $1 ]; then 57 | echo Restarting all processes: $jobId Instance: $instanceId 58 | $COMMAND ssh ${jobId}/${instanceId} "sudo -s /var/vcap/bosh/bin/monit restart all" 59 | continue 60 | fi 61 | processId=$(echo $x | awk -F "," '{ print $2 }') 62 | if [ -z $processId ]; then 63 | continue 64 | fi 65 | if [ $processId = $1 ]; then 66 | echo Restarting: $jobId Instance: $instanceId Process $processId 67 | $COMMAND ssh ${jobId}/${instanceId} "sudo -s /var/vcap/bosh/bin/monit restart $processId" 68 | fi 69 | done 70 | } 71 | 72 | startProcesses() { 73 | for x in $jobVMs; do 74 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 75 | instanceId=$(echo $x | awk -F "/" '{ print $2 }' | awk -F ',' '{ print $1 }') 76 | if [ "all" == $1 ]; then 77 | echo Starting all processes: $jobId Instance: $instanceId 78 | $COMMAND ssh ${jobId}/${instanceId} "sudo -s /var/vcap/bosh/bin/monit start all" 79 | continue 80 | fi 81 | processId=$(echo $x | awk -F "," '{ print $2 }') 82 | if [ -z $processId ]; then 83 | continue 84 | fi 85 | if [ $processId = $1 ]; then 86 | echo Starting: $jobId Instance: $instanceId Process $processId 87 | $COMMAND ssh ${jobId}/${instanceId} "sudo -s /var/vcap/bosh/bin/monit start $processId" 88 | fi 89 | done 90 | } 91 | 92 | 93 | nukeProcesses() { 94 | for x in $jobVMs; do 95 | jobId=$(echo $x | awk -F "/" '{ print $1 }') 96 | instanceId=$(echo $x | awk -F "/" '{ print $2 }' | awk -F ',' '{ print $1 }') 97 | processId=$(echo $x | awk -F "," '{ print $2 }') 98 | if [ -z $processId ]; then 99 | continue 100 | fi 101 | if [ $processId = $1 ]; then 102 | echo Deleting: $jobId Instance: $instanceId Directory /var/vcap/store/$processId 103 | $COMMAND ssh ${jobId}/${instanceId} "sudo -s rm -rf /var/vcap/store/$processId/*" 104 | fi 105 | done 106 | } 107 | 108 | if [ $1 == "brain-restart" ]; then 109 | jobVMs=$($COMMAND instances | awk -F '|' '{ print $2 }' | grep diego_brain) 110 | restartProcesses all 111 | fi 112 | 113 | 114 | if [ $1 == "consul-all" ]; then 115 | allJobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep consul_agent) 116 | jobVMs=$allJobVMs 117 | stopProcesses consul_agent 118 | nukeProcesses consul_agent 119 | echo Waiting 30 seconds for processes to finish exiting 120 | sleep 30 121 | # Start the consul server cluster first. 122 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep consul_server) 123 | startProcesses consul_agent 124 | echo Waiting 30 seconds for processes to finish starting 125 | sleep 30 126 | jobVMs=$allJobVMs 127 | startProcesses consul_agent 128 | fi 129 | 130 | if [ $1 == "consul-servers" ]; then 131 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep consul_server) 132 | stopProcesses consul_agent 133 | nukeProcesses consul_agent 134 | echo Waiting 30 seconds for processes to finish exiting 135 | sleep 30 136 | startProcesses consul_agent 137 | fi 138 | 139 | if [ $1 == "consul-restart" ]; then 140 | allJobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep consul_agent) 141 | jobVMs=$allJobVMs 142 | stopProcesses consul_agent 143 | echo Waiting 30 seconds for processes to finish exiting 144 | sleep 30 145 | # Start the consul server cluster first. 146 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep consul_server) 147 | startProcesses consul_agent 148 | echo Waiting 30 seconds for processes to finish starting 149 | sleep 30 150 | jobVMs=$allJobVMs 151 | startProcesses consul_agent 152 | fi 153 | 154 | if [ $1 == "etcd" ]; then 155 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep etcd_server) 156 | stopProcesses etcd 157 | nukeProcesses etcd 158 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep etcd_tls_server) 159 | stopProcesses etcd 160 | nukeProcesses etcd 161 | echo Waiting 30 seconds for processes to finish exiting 162 | sleep 30 163 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep etcd_server) 164 | startProcesses etcd 165 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep etcd_tls_server) 166 | startProcesses etcd 167 | fi 168 | 169 | if [ $1 == "cells" ]; then 170 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep diego_cell) 171 | stopProcesses consul_agent 172 | nukeProcesses consul_agent 173 | echo Waiting 30 seconds for processes to finish exiting 174 | sleep 30 175 | startProcesses consul_agent 176 | fi 177 | 178 | if [ $1 == "bbs" ]; then 179 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep diego_database) 180 | stopProcesses etcd 181 | nukeProcesses etcd 182 | echo Waiting 30 seconds for processes to finish exiting 183 | sleep 30 184 | startProcesses etcd 185 | fi 186 | 187 | if [ $1 == "ripley" ]; then 188 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g') 189 | allJobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g') 190 | jobVMs=$allJobVMs 191 | stopProcesses consul_agent 192 | nukeProcesses consul_agent 193 | echo Waiting 30 seconds for processes to finish exiting 194 | sleep 30 195 | # Start the consul server cluster first. 196 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep consul_server) 197 | startProcesses consul_agent 198 | jobVMs=$allJobVMs 199 | echo Waiting 30 seconds for processes to finish starting 200 | sleep 30 201 | startProcesses consul_agent 202 | stopProcesses etcd 203 | nukeProcesses etcd 204 | echo Waiting 30 seconds for processes to finish exiting 205 | sleep 30 206 | startProcesses etcd 207 | jobVMs=$($COMMAND instances -p --json | jq -r '.Tables[0].Rows[] | select(.process != "") | [ .instance, .process ] | @csv' | sed 's/"//g' | grep diego_brain) 208 | restartProcesses all 209 | fi 210 | 211 | --------------------------------------------------------------------------------