Skip to content

Instantly share code, notes, and snippets.

@onefoursix
Last active February 23, 2021 22:55
Show Gist options
  • Save onefoursix/de25588bcacdd23435984afc1c2d3532 to your computer and use it in GitHub Desktop.
Save onefoursix/de25588bcacdd23435984afc1c2d3532 to your computer and use it in GitHub Desktop.
A utility to initialize config files for HA instances of StreamSets Control Hub
#!/usr/bin/env bash
## set-component-ids.sh
## Run this script in the $DPM_CONF dir
##
## Pass in values to replace old componentId suffixes like "000" with new values like "001"
##
## Usage: ./set-component-ids.sh <OLD_SUFFIX> <NEW_SUFFIX>
## Example: ./set-component-ids.sh 000 001
OLD_VALUE=$1
NEW_VALUE=$2
## Replace the value in dpm.properties
sed -i.bak 's/dpm.componentId=dpmcore'"$OLD_VALUE"'/dpm.componentId=dpmcore'"$NEW_VALUE"'/' dpm.properties
## Replace the values in the *-app.property file
for COMPONENT in connection dynamic_preview jobrunner messaging notification pipelinestore policy provisioning reporting scheduler sdp_classification security sla timeseries topology; do
sed -i.bak 's/dpm.componentId='"$COMPONENT"''"$OLD_VALUE"'/dpm.componentId='"$COMPONENT"''"$NEW_VALUE"'/' $COMPONENT-app.properties
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment