├── .gitignore ├── 5.Installer └── README.md ├── 1.Base.CentOS ├── README.md └── Vagrantfile ├── 2.MultiNode └── README.md ├── 4.DSE ├── down.sh ├── README.md └── Vagrantfile ├── 3.MultiDC ├── up-parallel.sh ├── cassandra-topology.properties ├── README.md └── Vagrantfile ├── 6.DDAC ├── README.md ├── Vagrantfile └── ubuntu-bionic-18.04-cloudimg-console.log ├── 1.Base ├── Vagrantfile ├── sample_users.csv └── README.md ├── README.md └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .DS_Store 3 | .vagrant 4 | *.out.txt 5 | *.run 6 | *.tar.gz 7 | *.vdi 8 | *.loog 9 | -------------------------------------------------------------------------------- /5.Installer/README.md: -------------------------------------------------------------------------------- 1 | # 5.Installer Template 2 | 3 | The DataStax standalone installer is obsolete now and has been removed. 4 | -------------------------------------------------------------------------------- /1.Base.CentOS/README.md: -------------------------------------------------------------------------------- 1 | ## 1.Base.CentOS Template 2 | 3 | This is the same as the "1.Base" template, but using CentOS instead of Ubuntu. 4 | -------------------------------------------------------------------------------- /2.MultiNode/README.md: -------------------------------------------------------------------------------- 1 | # 2.MultiNode Template 2 | 3 | Note: This template originally also included OpsCenter. However, since [support was dropped for Apache Cassandra starting with OpsCenter 6.0](https://docs.datastax.com/en/opscenter/6.7/opsc/opscPolicyChanges.html), I've removed that from the project here. 4 | -------------------------------------------------------------------------------- /4.DSE/down.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Vagrant Cassandra Project 4 | # Brian Cantoni 5 | # 6 | # Clean shutdown of each DSE node (rather than just vagrant halting everything) 7 | 8 | for i in $(seq 1 4) 9 | do 10 | j=$((i-1)) 11 | echo Shutting down dse$j 12 | vagrant ssh dse$j -c 'sudo service dse stop; sleep 5; sudo shutdown -h now' 13 | done 14 | 15 | echo Done 16 | -------------------------------------------------------------------------------- /3.MultiDC/up-parallel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Vagrant Cassandra Project 4 | # Brian Cantoni 5 | # 6 | # Provisioning several VMs at once can be pretty slow depending on the speed of 7 | # the Ubuntu mirrors at the time. This script creates the 7 VMs in series, then 8 | # provisions them in parallel. 9 | # 10 | # Try running this script instead of "vagrant up" when creating the VMs for the 11 | # first time. 12 | # 13 | # source: 14 | # http://joemiller.me/2012/04/26/speeding-up-vagrant-with-parallel-provisioning/ 15 | 16 | MAX_PROCS=4 17 | 18 | parallel_provision() { 19 | while read box; do 20 | echo "Provisioning '$box'. Output will be in: $box.out.txt" 1>&2 21 | echo $box 22 | done | xargs -P $MAX_PROCS -I"BOXNAME" \ 23 | sh -c 'vagrant provision BOXNAME >BOXNAME.out.txt 2>&1 || echo "Error Occurred: BOXNAME"' 24 | } 25 | 26 | ## -- main -- ## 27 | 28 | # start boxes sequentially to avoid vbox explosions 29 | vagrant up --no-provision 30 | 31 | # but run provision tasks in parallel 32 | cat < node_script 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /6.DDAC/README.md: -------------------------------------------------------------------------------- 1 | # 4.DDAC Template 2 | 3 | This Vagrant template sets up DataStax Distribution of Apache Cassandra (DDAC) on a configurable number of VMs: 4 | 5 | * node[0-n] - DDAC nodes (with prerequisites and DDAC already installed) 6 | 7 | Notes: 8 | 9 | * Depending on how much memory your host system has, you may need to lower the default memory size for each VM. Currently it's set to 3GB for each VM. 10 | * This Vagrantfile assumes the current DDAC tarball has been downloaded locally into this directory. 11 | 12 | ## Instructions 13 | 14 | ### Setup 15 | 16 | Assuming you already have Vagrant installed, you can bring up the DDAC nodes with the following: 17 | 18 | ``` 19 | $ # optional: adjust NODES value in Vagrantfile (default 3) 20 | $ vagrant up 21 | ``` 22 | 23 | When the up command is done, you can check the status of the VMs: 24 | 25 | ``` 26 | $ vagrant status 27 | Configured for 3 node(s) 28 | Current machine states: 29 | 30 | node0 running (virtualbox) 31 | node1 running (virtualbox) 32 | node2 running (virtualbox) 33 | ``` 34 | 35 | ``` 36 | $ vagrant ssh node0 37 | vagrant@node0:~$ nodetool status 38 | Datacenter: datacenter1 39 | ======================= 40 | Status=Up/Down 41 | |/ State=Normal/Leaving/Joining/Moving 42 | -- Address Load Tokens Owns (effective) Host ID Rack 43 | UN 10.211.55.102 74.95 KiB 256 69.0% d4f41d2c-0824-488b-8eab-66c86a472f8e rack1 44 | UN 10.211.55.101 88.62 KiB 256 66.3% 5ed5ba19-e9df-4732-bb54-27247a1f1af7 rack1 45 | UN 10.211.55.100 108.47 KiB 256 64.6% fd5a9e7e-5ef7-41e9-b5b9-de2159cc860a rack1 46 | ``` 47 | 48 | ### Configure DDAC 49 | 50 | The default configuration will join all nodes together into a single cluster (with node0 as the seed node) and start the database on each node. Note that it's not installed as a service, so if the nodes are shutdown or restarted, Cassandra will need to be manually restarted as well. 51 | 52 | ### Shut Down 53 | 54 | To destroy all VMs: 55 | 56 | ``` 57 | $ vagrant destroy -f 58 | ``` 59 | -------------------------------------------------------------------------------- /4.DSE/README.md: -------------------------------------------------------------------------------- 1 | # 4.DSE Template 2 | 3 | This Vagrant template sets up DataStax Enterprise (DSE) on a configurable number of VMs: 4 | 5 | * dse[0-n] - DSE nodes (with prerequisites and DSE already installed) 6 | 7 | Notes: 8 | 9 | * Depending on how much memory your host system has, you may need to lower the default memory size for each VM. Currently it's set to 3GB for each VM. 10 | * This Vagrantfile will install the latest production version of DSE; you could also provide a specific version if you want (adjust the `dse-full` package version in the `apt-get install` command). 11 | 12 | ## Instructions 13 | 14 | ### Setup 15 | 16 | Bring up the DSE nodes with the following: 17 | 18 | ``` 19 | $ # optional: adjust DSE_NODES value in Vagrantfile (default 3) 20 | $ vagrant up 21 | ``` 22 | 23 | When the up command is done, you can check the status of the VMs: 24 | 25 | ``` 26 | $ vagrant status 27 | Configured for 3 DSE node(s) 28 | Current machine states: 29 | 30 | dse0 running (virtualbox) 31 | dse1 running (virtualbox) 32 | dse2 running (virtualbox) 33 | ``` 34 | 35 | ``` 36 | $ vagrant ssh dse0 37 | vagrant@dse0:~$ nodetool status 38 | Datacenter: Cassandra 39 | ===================== 40 | Status=Up/Down 41 | |/ State=Normal/Leaving/Joining/Moving 42 | -- Address Load Tokens Owns Host ID Rack 43 | UN 10.10.10.12 83.1 KB 1 ? a0376d25-e955-41f0-b098-e8ad30d2c530 rack1 44 | UN 10.10.10.10 77.35 KB 1 ? a9720ccb-2871-4b64-b565-18e517820a9b rack1 45 | UN 10.10.10.11 61.6 KB 1 ? 27661981-be43-4de8-8b16-3e322e948855 rack1 46 | ``` 47 | 48 | ### Configure DSE 49 | 50 | The default configuration will join all nodes together into a single cluster (with dse0 as the seed node) and start the services. For reference, see the [DataStax Enterprise documentation](https://docs.datastax.com/en/latest-dse/datastax_enterprise/production/initDSETOC.html) for all the details on DSE configuration settings. 51 | 52 | Mac users might find [bcantoni/i2cssh](https://github.com/bcantoni/i2cssh) helpful. It will connect with all Vagrant nodes in parallel iTerm2 shell windows: `i2cssh -v`. 53 | 54 | ### Shut Down 55 | 56 | To cleanly shut down all VMs, use the `down.sh` script: 57 | 58 | ``` 59 | $ ./down.sh 60 | ``` 61 | 62 | To destroy all VMs: 63 | 64 | ``` 65 | $ vagrant destroy -f 66 | ``` 67 | -------------------------------------------------------------------------------- /1.Base/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrant Cassandra Project 5 | # https://github.com/bcantoni/vagrant-cassandra 6 | # Brian Cantoni 7 | 8 | # This sample sets up 1 VM ('cassandra') with only Java installed. 9 | # See the README for a walkthrough explaining Cassandra and DataStax installation. 10 | 11 | # Adjustable settings 12 | CFG_MEMSIZE = "3000" # max memory for each VM 13 | CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc. 14 | CFG_IP = "10.211.54.10" # private IP address 15 | 16 | # if local Debian proxy configured (DEB_CACHE_HOST), install and configure the proxy client 17 | deb_cache_cmds = "" 18 | if ENV['DEB_CACHE_HOST'] 19 | deb_cache_host = ENV['DEB_CACHE_HOST'] 20 | deb_cache_cmds = < /etc/timezone 35 | dpkg-reconfigure -f noninteractive tzdata 36 | 37 | #{deb_cache_cmds} 38 | 39 | # install Java and a few base packages 40 | add-apt-repository ppa:openjdk-r/ppa 41 | apt-get update 42 | apt-get install vim curl zip unzip git tree python-pip -y -q 43 | 44 | # Java install - adjust if needed 45 | # apt-get install openjdk-7-jdk -y -q 46 | apt-get install openjdk-8-jdk -y -q 47 | 48 | echo "Vagrant provisioning complete" 49 | SCRIPT 50 | 51 | 52 | # Configure VM server 53 | VAGRANTFILE_API_VERSION = "2" 54 | 55 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 56 | config.vm.define :cassandra do |x| 57 | x.vm.box = "ubuntu/xenial64" 58 | x.vm.provider "vmware_fusion" do |v| 59 | v.vmx["memsize"] = CFG_MEMSIZE 60 | end 61 | x.vm.provider :virtualbox do |v| 62 | v.name = "cassandra" 63 | v.customize ["modifyvm", :id, "--memory", CFG_MEMSIZE] 64 | v.customize ["modifyvm", :id, "--cpus" , "2" ] 65 | end 66 | x.vm.network :private_network, ip: CFG_IP 67 | x.vm.hostname = "cassandra" 68 | x.vm.provision :shell, :inline => node_script 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /3.MultiDC/README.md: -------------------------------------------------------------------------------- 1 | # 3.MultiDC Template 2 | 3 | This Vagrant template sets up 6 separate VMs for creating a multi-datacenter Apache Cassandra cluster: 4 | 5 | * node[11-16] - [Cassandra](https://cassandra.apache.org/) nodes 6 | 7 | The Vagrantfile in this example creates the VMs, installs Cassandra, then configures the 6-node cluster into two different logical datacenters (DC1 and DC2). 8 | 9 | Notes: 10 | 11 | * Depending on how much memory your host system has, you may need to lower the default memory size for each VM. Currently it's set to 1400 MB for each VM, but with all 6 running it may be too much for your host. You could lower SERVER_COUNT in Vagrantfile if needed. 12 | 13 | ## Instructions 14 | 15 | ### Setup 16 | 17 | If Vagrant has been installed correctly, you can bring up the 6 VMs with the following: 18 | 19 | ``` 20 | $ ./up-parallel.sh 21 | ``` 22 | 23 | Note: This will bring up each VM in series and then provision each in parallel. You can also just run `vagrant up` which does everything in series and will be slower. 24 | 25 | When the provisioning process is done, you can check the status of the VMs: 26 | 27 | ``` 28 | $ vagrant status 29 | Current machine states: 30 | 31 | node11 running (virtualbox) 32 | node12 running (virtualbox) 33 | node13 running (virtualbox) 34 | node14 running (virtualbox) 35 | node15 running (virtualbox) 36 | node16 running (virtualbox) 37 | ``` 38 | 39 | Log in to one node and check the Cassandra cluster status. You should see all 6 nodes up and running: 40 | 41 | ``` 42 | $ vagrant ssh node11 43 | $ nodetool status 44 | Datacenter: DC1 45 | =============== 46 | Status=Up/Down 47 | |/ State=Normal/Leaving/Joining/Moving 48 | -- Address Load Tokens Owns (effective) Host ID Rack 49 | UN 10.211.55.113 86.26 KB 256 34.7% f42d6001-9e74-4249-b510-35c4942ea059 RAC1 50 | UN 10.211.55.115 69.56 KB 256 31.4% b4f89779-d832-4c9e-9cde-03b116dfde0f RAC1 51 | UN 10.211.55.111 41.07 KB 256 33.3% 0454cb56-fd91-4857-8ce5-60cbf39a8ff3 RAC1 52 | Datacenter: DC2 53 | =============== 54 | Status=Up/Down 55 | |/ State=Normal/Leaving/Joining/Moving 56 | -- Address Load Tokens Owns (effective) Host ID Rack 57 | UN 10.211.55.116 69.92 KB 256 34.3% 37ee2707-e133-4557-9c14-577712f8e9d8 RAC1 58 | UN 10.211.55.112 57.16 KB 256 33.0% 4830a1ad-88c2-4f8a-96a0-11480614c00e RAC1 59 | UN 10.211.55.114 65.56 KB 256 33.2% 6fda6f3f-8f94-4f80-a228-09d415dfd70f RAC1 60 | ``` 61 | 62 | ### Cassandra Versions 63 | 64 | This template is currently set to install the latest Apache Cassandra 3.6.x. You can adjust the Cassandra version if needed in the Vagrantfile by adjusting the repo or the specific version number. 65 | 66 | Note: This template originally also included OpsCenter. However, since [support was dropped for Apache Cassandra starting with OpsCenter 6.0](https://docs.datastax.com/en/opscenter/6.7/opsc/opscPolicyChanges.html), I've removed that from the project here. 67 | 68 | ### Shut Down 69 | 70 | To cleanly shut down all VMs: 71 | 72 | ``` 73 | $ for i in {1..6}; do vagrant ssh node1$i -c 'sudo shutdown -h now'; done 74 | ``` 75 | 76 | To destroy all VMs: 77 | 78 | ``` 79 | $ vagrant destroy -f 80 | ``` 81 | -------------------------------------------------------------------------------- /6.DDAC/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrant Cassandra Project 5 | # https://github.com/bcantoni/vagrant-cassandra 6 | # Brian Cantoni 7 | 8 | # This template sets up a multi-node cluster running DataStax Distribution of Apache 9 | # Cassandra (DDAC). Adjust NODES variable below to change the number of nodes. 10 | 11 | # Adjustable settings 12 | CFG_MEMSIZE = "3000" # max memory for each VM 13 | CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc. 14 | NETWORK = '10.211.55.' # base IP for DSE nodes 15 | FIRST_IP = 100 16 | 17 | # number of nodes to create 18 | NODES = 3 19 | 20 | # Provisioning script for DDAC nodes (node10, node11, ...) 21 | # todo: better dynamic generation of /etc/hosts list 22 | node_script = <