GithubHelp home page GithubHelp logo

vagrant-cassandra-1's Introduction

vagrant-cassandra

vagrant-cassandra quickly provisions a multi-VM Cassandra deployment using Vagrant. It leverages the cassandra-chef-cookbook project to do the heavy lifting.

Dependencies

  • Vagrant
  • VirtualBox
  • librarian

Usage

Deploying a three-node Cassandra cluster:

git clone git://github.com/calebgroom/vagrant-cassandra.git
cd vagrant-cassandra/vagrant
librarian-chef install
cd ..
vagrant up

SSH into the first node and check the status of the ring:

vagrant ssh node1
/usr/local/cassandra/bin/nodetool -h 192.168.2.10 ring
Address         DC          Rack        Status State   Load            Effective-Ownership Token
113427455640312821154458202477256070484     
192.168.2.10    datacenter1 rack1       Up     Normal  83.19 KB        66.67%              0                                           
192.168.2.11    datacenter1 rack1       Up     Normal  65.91 KB        66.67%              56713727820156410577229101238628035242      
192.168.2.12    datacenter1 rack1       Up     Normal  52.62 KB        66.67%              113427455640312821154458202477256070484

Loading Sample Data

SSH into one of the nodes and open a command-line prompt to enter Cassandra commands:

vagrant ssh node2
/usr/local/cassandra/bin/cassandra-cli -h 192.168.2.11

Copy and paste this sample data set:

create keyspace demo
  with placement_strategy = 'SimpleStrategy'
  and strategy_options = {replication_factor: 2};

use demo;

create column family Users                
  with key_validation_class = 'UTF8Type'    
  and comparator = 'UTF8Type'               
  and default_validation_class = 'UTF8Type';

update column family Users with
  column_metadata =
    [
      {column_name: first, validation_class: UTF8Type},
      {column_name: last, validation_class: UTF8Type},
      {column_name: age, validation_class: UTF8Type, index_type: KEYS}
    ];

assume Users keys as utf8;

set Users['jsmith']['first'] = 'John';
set Users['jsmith']['last'] = 'Smith';
set Users['jsmith']['age'] = '38';

Verify another node in the cluster can read the the jsmith record:

vagrant ssh node3
/usr/local/cassandra/bin/cassandra-cli -h 192.168.2.12
[default@unknown] use demo;
Authenticated to keyspace: demo
[default@demo] get Users['jsmith'];
=> (column=age, value=38, timestamp=1355649566834000)
=> (column=first, value=John, timestamp=1355649564055000)
=> (column=last, value=Smith, timestamp=1355649564391000)
Returned 3 results.
Elapsed time: 51 msec(s).

Fail a Node

The demo keyspace has a replication factor of 2. Stop Cassandra on one of the nodes and verify that the jsmith record is still retrievable.

Take down node1:

vagrant ssh node1
sudo /etc/init.d/cassandra stop

Verify that node3 can still read:

[default@unknown] use demo;
Authenticated to keyspace: demo
[default@demo] get Users['jsmith'];
=> (column=age, value=38, timestamp=1355649566834000)
=> (column=first, value=John, timestamp=1355649564055000)
=> (column=last, value=Smith, timestamp=1355649564391000)
Returned 3 results.
Elapsed time: 92 msec(s).

Taking down node1 and node2 might prevent node3 from being able to read the jsmith record if node3 is not responsible for the area in the keyspace where the record is stored.

vagrant-cassandra-1's People

Contributors

acobley avatar buger avatar calebgroom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.