Last active
November 10, 2020 15:22
-
-
Save deanproctor/764211ae6a9734a7f44be856eff1d04c to your computer and use it in GitHub Desktop.
Script to upgrade a tarball installation of StreamSets Data Collector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This script will update a tarball installation of StreamSets Data Collector. | |
Set your environment configuration in the script, including the stage library packages you want upgraded. | |
Run the script: | |
chmod 755 upgrade-sdc.sh | |
./upgrade-sdc.sh | |
The script will output a list of configuration files that differ between the old and new SDC versions. You will need to manually merge any changes. This can be done visually using vimdiff: | |
vimdiff /etc/sdc/sdc.properties /opt/streamsets-datacollector/etc/sdc.properties | |
Type "do" to accept a change from the new version of the config file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
###################### | |
# Config | |
###################### | |
SDC_VERSION=3.19.0 | |
SDC_ROOT=/opt | |
SDC_HOME=$SDC_ROOT/streamsets-datacollector | |
SDC_CONF=/etc/sdc | |
SDC_DATA=/var/lib/sdc | |
SDC_RESOURCES=/var/lib/sdc-resources | |
SDC_USER=sdc | |
SDC_GROUP=sdc | |
OS_PACKAGES="core crypto-lib jdbc-lib jython_2_7-lib orchestrator-lib salesforce-lib" | |
ENT_PACKAGES="databricks-lib-1.1.0" | |
###################### | |
# Installation Script | |
###################### | |
echo "Stopping sdc service" | |
sudo systemctl -q stop sdc | |
echo "Backing up current installation to $SDC_HOME.old" | |
sudo cp -R $SDC_HOME $SDC_HOME.old | |
echo "Backing up data directory to $SDC_DATA.old" | |
sudo cp -R $SDC_DATA $SDC_DATA.old | |
echo "Backing up resources directory to $SDC_RESOURCES.old" | |
sudo cp -R $SDC_RESOURCES $SDC_RESOURCES.old | |
echo "Removing conflicting jars" | |
sudo rm -rf $SDC_HOME/streamsets-libs $SDC_HOME/container-lib $SDC_HOME/api-lib $SDC_HOME/cli-lib $SDC_HOME/libexec/bootstrap-libs $SDC_HOME/root-lib | |
sudo mv $SDC_HOME $SDC_HOME-$SDC_VERSION | |
echo "Downloading StreamSets packages..." | |
for pkg in $OS_PACKAGES | |
do | |
echo -e "\t$pkg" | |
wget -qO - https://s3-us-west-2.amazonaws.com/archives.streamsets.com/datacollector/$SDC_VERSION/tarball/streamsets-datacollector-$pkg-$SDC_VERSION.tgz | sudo tar xzf - -C $SDC_ROOT | |
done | |
for pkg in $ENT_PACKAGES | |
do | |
echo -e "\t$pkg" | |
wget -qO - https://s3-us-west-2.amazonaws.com/archives.streamsets.com/datacollector/enterprise/tarball/enterprise/streamsets-datacollector-$pkg.tgz | sudo tar xzf - -C $SDC_HOME-$SDC_VERSION | |
done | |
echo "Renaming download directory to $SDC_HOME" | |
sudo mv $SDC_HOME-$SDC_VERSION $SDC_HOME | |
echo "Setting sdc user permissions" | |
sudo chown -R $SDC_USER:$SDC_GROUP $SDC_HOME | |
echo "Starting sdc service" | |
sudo systemctl -q enable sdc | |
sudo systemctl -q start sdc | |
echo "Upgrade Complete" | |
echo | |
echo "Config files in $SDC_CONF were not automatically upgraded. Here are the files with differences:" | |
echo | |
sudo diff -q $SDC_CONF $SDC_HOME/etc/ | |
sudo diff -q $SDC_HOME.old/libexec/sdc-env.sh $SDC_HOME/libexec/sdc-env.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment