Cassandra

Distributed key/value store.

Below is a puppet manifest that will download the tar from a file store, uncompress and create the symlinks also supporting single node configuration distribution for tokens and such that are unique to the node.

Puppet manifest:

##

# BEGIN Class Roles

##

class cassandra {

include cassandra::requires

include cassandra::packages

include cassandra::files

include cassandra::downloads

include cassandra::uncompress

include cassandra::symlinks

}

class cassandra::zones::server {

include cassandra::server::packages

include cassandra::zones::server::files

include cassandra::server::services

}

##

# BEGIN Implementation

##

class cassandra::requires {

}

class cassandra::packages {

}

class cassandra::files {

file {

'/etc/services':

mode => '644', owner => 'root', group => 'root',

source => 'puppet:///modules/cassandra/etc/services';

'/etc/profile.d/cassandra.sh':

mode => '644', owner => 'root', group => 'root',

source => 'puppet:///modules/cassandra/etc/profile.d/cassandra.sh';

'/etc/security/limits.d/91-nofile.conf':

mode => '644', owner => 'root', group => 'root',

source => 'puppet:///modules/cassandra/etc/security/limits.d/91-nofile.conf';

'/data/cassandra':

mode => '755', owner => $cassandra_user, group => $cassandra_user,

ensure => directory;

'/var/log/cassandra':

mode => '755', owner => $cassandra_user, group => $cassandra_user,

ensure => directory;

#'/var/run/cassandra':

# mode => '755', owner => $cassandra_user, group => $cassandra_user,

# ensure => directory;

'/var/cassandra':

mode => '755', owner => $cassandra_user, group => $cassandra_user,

ensure => directory;

}

}

class cassandra::downloads {

exec {

'download-cassandra':

require => File['puppetstore'],

cwd => '/etc/puppet/.keep',

command => "$pkgstore_dl_cmd/$cassandra_pkg",

timeout => '-1',

creates => "/etc/puppet/.keep/$cassandra_pkg";

}

}

class cassandra::uncompress {

exec {

'unpack-cassandra':

require => Class['cassandra::downloads'],

cwd => '/usr/local',

command => "tar zxvf /etc/puppet/.keep/$cassandra_pkg && chown -R $cassandra_user:$cassandra_user /usr/local/$cassandra_dir",

timeout => '-1',

creates => "/usr/local/$cassandra_dir";

}

}

class cassandra::symlinks {

exec {

'link-cassandra':

require => Class['cassandra::uncompress'],

command => "ln -s /usr/local/$cassandra_dir /usr/local/apache-cassandra",

creates => '/usr/local/apache-cassandra';

}

}

##

# BEGIN Extensions

##

class cassandra::zones::server::files inherits cassandra::server::files {

File[''] {

source => [

"puppet:///modules/$my_project/cassandra/$my_zone/$fqdn/file",

"puppet:///modules/$my_project/cassandra/$my_zone/file"

],

}

File[''] {

content => cassandra("$my_project/cassandra/$my_zone/file.erb"),

}

}

References:

http://wiki.apache.org/cassandra/Operations