Skip to content

Instantly share code, notes, and snippets.

@aliakhtar
Last active October 13, 2016 17:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aliakhtar/3649e412787034156cbb to your computer and use it in GitHub Desktop.
Save aliakhtar/3649e412787034156cbb to your computer and use it in GitHub Desktop.
#~/bin/bash
#Installs Cassandra. Instructions from https://gist.github.com/hengxin/8e5040d7a8b354b1c82e and http://www.datastax.com/documentation/cassandra/2.0/cassandra/install/installDeb_t.html
cd ~/
sudo mkdir /usr/lib/jvm
curl -O -J -L -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u40-b25/jdk-8u40-linux-x64.tar.gz
sudo tar zxvf jdk*.tar.gz -C /usr/lib/jvm
rm -f jdk*.gz
sudo mv /usr/lib/jvm/jdk* /usr/lib/jvm/jdk #move jdk.1.xxxx to just jdk
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk/bin/java" 100
sudo update-alternatives --set java /usr/lib/jvm/jdk/bin/java
java -version
sudo apt-get install libjna-java
echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
sudo apt-get update
sudo apt-get install dsc20=2.0.12-1 cassandra=2.0.12
sudo service cassandra stop
sudo rm -rf /var/lib/cassandra/data/system/*
#Set recommended settings, via: http://www.datastax.com/documentation/cassandra/2.0/cassandra/install/installRecommendSettings.html
# taken from: http://www.linuxask.com/questions/permission-denied-when-doing-redirection-with-sudo
sudo sh -c 'echo 0 > /proc/sys/vm/zone_reclaim_mode'
echo "vm.max_map_count = 131072" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
sudo swapoff --all
echo "INFORMATION:"
echo "Make changes to /etc/security/limits.d/cassandra.conf and /etc/security/limits.conf manually as per http://www.datastax.com/documentation/cassandra/2.0/cassandra/install/installRecommendSettings.html ."
echo "Remember to change listen_address , broadcast_address, seeds, snitch, cluster name, rpc_address in /etc/cassandra/cassandra.yaml."
echo "rpc_address should be 0.0.0.0 to allow clients to connect."
#echo "snitch: Ec2MultiRegion, seeds: public ip, listen_address: private ip, broadcast_address: public ip. Ports would need to be opened. Secure cluster first."
echo "snitch: Ec2Snitch, seeds: private, listen_address: private ip, broadcast_address: private ip"
echo "To change data storage directories, change commitlog_directory and data_file_directories"
echo "For OpsCenter, see comments in script"
# For OPS Center:
# To install, see http://www.datastax.com/documentation/opscenter/4.0/opsc/install/opscInstallOpsc_g.html
# - If Ops center is running on the same instance as c*, use 127.0.0.1 for the cluster IP address, when adding cluster.
# An OpsCenter agent would need to be running on the instance where C* is running, in order for a lot of functionality
# to work. See http://www.datastax.com/documentation/opscenter/4.0/opsc/install/installingAgents.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment