Wednesday, January 22, 2014

Setting up a Cassandra cluster on Windows with a vagrant virtualbox

Setting up Cassandra on windows can now be a pain with all it's dependancies, but it's something I'll cover in a later post.  One simpler way is to get C* running in a virtual box and perhaps even run it as a mini cluster.  This can be helped a lot by using Vagrant, but even that isn't quite straight forward.

The following has worked for me and is based heavily on the work done by calebgroom  and his github contribution vagrant-cassandra.  I've altered it a bit for use with the latest C* which adds virtual nodes etc.  Using these instructions you should be able to provisiona 3 node C* cluster with vnodes.

1: Install oracle Vm Virtualbox from https://www.virtualbox.org/ the latest version should do.
2: Install git for windows http://msysgit.github.io/ ensure you select the option to run git from the command line.
3: Install ruby for windows http://rubyinstaller.org/ V2.x.x Select all options
4: Download devkit DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
4.1: Extract it to a permeant location
4.2 Start "commandline" with ruby from
4.3 Change to devkit location and run
    ruby dk.rb init
    ruby dk.rb install

5 At any location run gem install librarian-chef (This may take sometime)
6 Download vagrant (http://www.vagrantup.com/ ) and install it
7: Open a command prompt and git clone https://github.com/acobley/vagrant-cassandra.git
8:  change to the directory vagrant-cassandra\vagrant and run
   librarian-chef install
9: Open vagrant/cookbooks/java/attributes and edit default.rb so that
    default['java']['jdk_version'] = '7'
   
10: If you want comment, out the “DL is deprecated, please use Fiddle” warning at C:\HashiCorp\Vagrant\embedded\lib\ruby\2.0.0\dl.rb
11: change to the vagrant-cassandra and run
    Vagrant up
This could take some time, but once it's finished you should be able to ssh to the virtual machine if you have a ssh installed.

   vagrant ssh node1

If you don't have ssh installed the the git installation comes with a ssh client so add c:\program files\git\bin to your path

 set PATH=%PATH%;c:\program files\git\bin

 Or set the path environment variable from the control panel.

 You can then ssh to the virtual host
  
  ssh vagrant@127.0.0.1 -p 2222 -i c:/users/*username*/.vagrant.d/insecure_private_key
 
Once inside the virtual machines you can test and see if  it works by getting the c* status by typing

/usr/local/cassandra/bin/nodetool -h 192.168.2.10 status





You can bring down the cluster with vagrant halt  and remove it with vagrant destroy (but then you'll need to start again!)

Vagrant can also be run on a mac.  Make sure you have vitualbox installed, clone the https://github.com/acobley/vagrant-cassandra.git and follow the instructions in the readme.

3 comments:

  1. Thank You For Sharing Information
    "Sanjary Academy provides excellent training for Piping design course. Best Piping Design Training Institute in Hyderabad,
    Telangana. We have offer professional Engineering Course like Piping Design Course,QA / QC Course,document Controller
    course,pressure Vessel Design Course, Welding Inspector Course, Quality Management Course, #Safety officer course."
    Piping Design Course in India­
    Piping Design Course in Hyderabad
    Piping Design Course in Hyderabad
    QA / QC Course
    QA / QC Course in india
    QA / QC Course in Hyderabad
    Document Controller course
    Pressure Vessel Design Course
    Welding Inspector Course
    Quality Management Course
    Quality Management Course in india
    Safety officer course

    ReplyDelete
  2. Nice Post
    Yaaron Studios is one of the rapidly growing editing studios in Hyderabad. We are the best Video Editing services in Hyderabad. We provides best graphic works like logo reveals, corporate presentation Etc. And also we gives the best Outdoor/Indoor shoots and Ad Making services.
    video editors studio in hyderabad
    short film editors in hyderabad
    corporate video editing studio in hyderabad
    ad making company in hyderabad

    ReplyDelete