Skip to content

Instantly share code, notes, and snippets.

@lewismj
Last active November 5, 2016 06:03
Show Gist options
  • Select an option

  • Save lewismj/bac050af02cb04419bce4a1c61942b03 to your computer and use it in GitHub Desktop.

Select an option

Save lewismj/bac050af02cb04419bce4a1c61942b03 to your computer and use it in GitHub Desktop.
OpsCenter & Single Node DSE Install
#!/bin/bash
# install.sh
# install.sh with no arguments will install OpsCenter.
# install.sh --with-dse to install DSE
# n.b.
# For running DSE in the cloud we usually install OpsCenter
# on one node, then use OpsCenter to install on the other EC2
# nodes.
#
# n.b.
# Use this only if you want to build a physical cluster.
# Otherwise, just use
#
# docker run --name some-dse -d luketillman/datastax-enterprise:5.0.3
# Check to see if we want to install DSE in addition
# to OpsCenter.
for i in "$@"
do
case $i in
--with-dse)
INSTALL_DSE=YES
shift # past argument with no value
;;
*)
esac
done
# Set your DSE login details, username and password.
# n.b assuming no escape chars in password.
echo -n "Enter your DSE email address:"
read DSE_USER
DSE_USER_ENC=$(echo $DSE_USER | sed 's/@/%40/g')
echo -n "Enter your DSE password: "
read -s DSE_PASS
# Ensure that we have an up-to-date instance.
yum -y upgrade
yum -y update
# Install wget and make sure we have the EPEL repository.
yum -y install wget
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y install ./epel-release-latest-6.noarch.rpm
# Add DataStax repo.
cat <<EOT >> /etc/yum.repos.d/datastax.repo
[opscenter]
name = DataStax Repository
baseurl = https://${DSE_USER_ENC}:${DSE_PASS}@rpm.datastax.com/enterprise
enabled = 1
gpgcheck = 0
EOT
# Intall opscenter.
yum -y install opscenter
# Switch off SSL for dev/demo.
cat <<EOT >> /etc/opscenter/opscenterd.conf
# Switch off SSL for development installation.
[agents]
use_ssl=false
EOT
# Start opscenter daemon.
service opscenterd start
# Install DSE if it was requested.
if [ "$INSTALL_DSE" = "YES" ]; then
echo "Installing DSE ..."
yum -y install java-1.8.0
curl --user ${DSE_USER}:${DSE_PASS} -O http://downloads.datastax.com/enterprise/DataStaxEnterprise-5.0.3-linux-x64-installer.run
chmod u+x ./DataStaxEnterprise-5.0.3-linux-x64-installer.run
./DataStaxEnterprise-5.0.3-linux-x64-installer.run
cat <<EOT >> /usr/share/opscenter/agent/conf/address.yaml
stomp_interface: 127.0.0.1
use_ssl: 0
EOT
yum -y install datastax-agent
echo "stomp_interface: reachable_opscenterd_ip" | tee -a /var/lib/datastax-agent/conf/address.yaml
# Final restart usually required.
service opscenterd restart
service dse restart
service datastax-agent start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment