Permalink
Browse files

Full rework of all the cookbooks. MAY NOT COMPILE FIRST.

  • Loading branch information...
0 parents commit b17b4b871199612bcea144e4c96e620f20d9259e @joaquincasares joaquincasares committed Aug 12, 2011
@@ -0,0 +1,159 @@
+= DESCRIPTION:
+
+This script launches a Apache Cassandra cluster of a predetermined size.
+
+This has been tested in Ubuntu 10.10 and CentOS 5.5, but should support your version of Ubuntu, CentOS, and RedHat.
+
+This script will be developed and housed at: https://github.com/riptano/chef.
+
+= REQUIREMENTS:
+
+Follow the instructions as listed here: http://wiki.opscode.com/display/chef/Quick+Start.
+
+== Configure cloud access
+
+Proceed to configure your cloud access by adding these following lines to your ~/.chef/knife.rb file.
+
+ # Information can be found at: https://manage.rackspacecloud.com/APIAccess.do
+ knife[:rackspace_api_username] = "USER"
+ knife[:rackspace_api_key] = "KEY"
+
+ # Information can be found at: https://aws-portal.amazon.com/gp/aws/developer/account?ie=UTF8&action=access-key
+ knife[:aws_access_key_id] = "ID"
+ knife[:aws_secret_access_key] = "KEY"
+
+Place this directory into your cookbooks folder.
+
+Download and place the apt cookbook in your cookbooks folder.
+The apt recipe can be found here: http://community.opscode.com/cookbooks/apt
+
+Then run:
+
+ knife cookbook upload -a -o cookbooks/
+
+You should see something similar to:
+
+ Uploading apt [1.1.2]
+ Uploading cassandra [0.1.4]
+ Uploading chef-client [0.99.5]
+ upload complete
+
+= ATTRIBUTES:
+
+The main attributes to look can be found at $CHEF_HOME/cookbooks/cassandra/attributes/default.rb and are:
+
+ # Needed for the Chef script to function properly
+ default[:setup][:deployment] = "08x" # Choices are "07x", or "08x"
+ default[:setup][:cluster_size] = 4
+ default[:setup][:current_role] = "cassandra"
+
+ # A unique name is preferred to stop the risk of different clusters joining each other
+ default[:cassandra][:cluster_name] = "Cassandra Cluster"
+
+ # It is best to have the commit log and the data
+ # directory on two seperate drives
+ default[:cassandra][:commitlog_dir] = "/var/lib"
+ default[:cassandra][:data_dir] = "/var/lib"
+
+For more information, look over $CHEF_HOME/cookbooks/cassandra/metadata.rb.
+
+To obtain a free OpsCenter license, please visit: http://www.datastax.com/opscenter.
+
+After properly configuring the attributes, upload the cookbook files again by running:
+
+ knife cookbook upload -a -o cookbooks/
+
+= USAGE:
+
+== Configure roles
+
+Run this line from your default chef folder:
+
+ knife role create cassandra
+
+where "cassandra" is the value declared as default[:setup][:current_role]. Edit the file to look very similar to this:
+
+ {
+ "name": "cassandra",
+ "default_attributes": {
+ },
+ "json_class": "Chef::Role",
+ "env_run_lists": {
+ },
+ "run_list": [
+ "recipe[cassandra]" # This is the line of importance
+ ],
+ "description": "",
+ "chef_type": "role",
+ "override_attributes": {
+ }
+ }
+
+This means that the role, that you can assign to many machines, will run this recipe upon assignment and will be bound within a group for easy clustering.
+
+== Starting up a cluster
+
+An Ubuntu 10.10 cloud in Rackspace:
+
+ knife rackspace server create -r "role[cassandra]" -i 69 -f 6 -S Server01 -N Server01
+ knife rackspace server create -r "role[cassandra]" -i 69 -f 6 -S Server02 -N Server02
+ knife rackspace server create -r "role[cassandra]" -i 69 -f 6 -S Server03 -N Server03
+ knife rackspace server create -r "role[cassandra]" -i 69 -f 6 -S Server04 -N Server04
+
+An Ubuntu 10.10 cloud in EC2:
+
+ pemname=<pemFileName> # do not include ".pem"
+ group=<securityGroupName>
+ knife ec2 server create -r "role[cassandra]" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server01
+ knife ec2 server create -r "role[cassandra]" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server02
+ knife ec2 server create -r "role[cassandra]" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server03
+ knife ec2 server create -r "role[cassandra]" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server04
+
+NOTE: These AMIs only work in the US-East region. For all other regions, see http://cloud.ubuntu.com/ami/.
+
+A Debian 6.0 (Squeeze) cloud in Rackspace:
+
+ knife rackspace server create -r "role[cassandra]" -i 75 -f 6 -S Server01 -N Server01
+ knife rackspace server create -r "role[cassandra]" -i 75 -f 6 -S Server02 -N Server02
+ knife rackspace server create -r "role[cassandra]" -i 75 -f 6 -S Server03 -N Server03
+ knife rackspace server create -r "role[cassandra]" -i 75 -f 6 -S Server04 -N Server04
+
+A CentOS 5.5 cloud in Rackspace:
+
+ knife rackspace server create -r "role[cassandra]" -i 51 -f 6 -d centos5-gems -S Server01 -N Server01
+ knife rackspace server create -r "role[cassandra]" -i 51 -f 6 -d centos5-gems -S Server02 -N Server02
+ knife rackspace server create -r "role[cassandra]" -i 51 -f 6 -d centos5-gems -S Server03 -N Server03
+ knife rackspace server create -r "role[cassandra]" -i 51 -f 6 -d centos5-gems -S Server04 -N Server04
+
+NOTE: You can run these lines more times as long as the attributes are set properly. Also, these lines should be run consecutively and never in parallel.
+
+== Bootstrapping Commands
+
+In order to run bootstrapping commands, you must be able to complete a passwordless SSH login. Typically, by copying your ~/.ssh/id_rsa.pub key into the target machine's ~/.ssh/authorized_keys file, passwordless SSH should work. Search google for more information.
+
+For an Ubuntu/Debian Machine:
+
+ knife bootstrap -r recipe['cassandra'] --sudo -x root <publicDNS>
+
+For an Ubuntu Machine on EC2:
+
+ knife bootstrap -r recipe['cassandra'] --sudo -x ubuntu <publicDNS>
+
+For a CentOS 5 Machine:
+
+ knife bootstrap -r "recipe['cassandra']" --sudo -x root -d centos5-gems <publicDNS>
+
+For a RedHat 5 Machine (Untested):
+
+ wget http://goo.gl/0k8mV -O- > ~/.chef/bootstrap/rhel5-rbel.erb
+ knife bootstrap --sudo -x root -d rhel5-rbel <publicDNS>
+ knife bootstrap -r recipe['cassandra'] --sudo -x root -d rhel5-rbel <publicDNS>
+
+
+== Other Useful Debugging Commands
+
+This commands shows the json for a chosen machine that is accessible through the Chef script:
+
+ knife node show Server01 --format json
+ knife cookbook metadata cassandra -o cookbooks
+
@@ -0,0 +1,22 @@
+# Needed for the Chef script to function properly
+default[:setup][:deployment] = "08x" # Choices are "07x", or "08x"
+default[:setup][:cluster_size] = 4
+default[:setup][:current_role] = "cassandra"
+
+# A unique name is preferred to stop the risk of different clusters joining each other
+default[:cassandra][:cluster_name] = "Cassandra Cluster"
+
+# It is best to have the commit log and the data
+# directory on two seperate drives
+default[:cassandra][:commitlog_dir] = "/var/lib"
+default[:cassandra][:data_dir] = "/var/lib"
+
+
+# Advanced Cassandra settings
+default[:cassandra][:token_position] = false
+default[:cassandra][:initial_token] = false
+default[:cassandra][:seed] = false
+default[:cassandra][:rpc_address] = "0.0.0.0"
+default[:cassandra][:confPath] = "/etc/cassandra/"
+
+default[:internal][:prime] = true
Oops, something went wrong.

0 comments on commit b17b4b8

Please sign in to comment.