Skip to content
Browse files

Changes to the readme's and to the folder ownership code.

  • Loading branch information...
1 parent 83fb599 commit 523e2d69803d0a5dafe9557b5a85f5623e981e4b Joaquin Casares committed Aug 12, 2011
Showing with 26 additions and 19 deletions.
  1. +20 −16 README.rdoc
  2. +1 −1 metadata.json
  3. +3 −0 recipes/install.rb
  4. +2 −2 recipes/write_configs.rb
View
36 README.rdoc
@@ -105,14 +105,14 @@ The list of the ports required to be open are as follows:
== Starting up a cluster
-An Ubuntu 10.10 cloud in Rackspace:
+An Ubuntu 10.10 cloud in Rackspace (login as root):
- 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
+ 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:
+An Ubuntu 10.10 cloud in EC2 (login as ubuntu):
pemname=<pemFileName> # do not include ".pem"
group=<securityGroupName>
@@ -123,22 +123,26 @@ An Ubuntu 10.10 cloud in EC2:
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:
+A Debian 6.0 (Squeeze) cloud in Rackspace (login as root):
- 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
+ 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:
+A CentOS 5.5 cloud in Rackspace (login as root):
- 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
+ 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.
+Keep in mind that these commands start up ONE cluster. By running these same four commands repeatedly, you will keep manipulating the same logical cluster of nodes which may serve unintended results. To create different clusters, either create new roles or remove the previous nodes from OpsCodes's Managment Console (https://manage.opscode.com/nodes). This is due to the fact that these scripts need to know the end size that Cassandra will grow to become to evenly parse the ring.
+
+If you wish to add more nodes to the same cluster, however, then simply change ([:cassandra][:token_position] or [:cassandra][:initial_token]) and [:setup][:cluster_size].
+
== 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.
View
2 metadata.json
@@ -219,7 +219,7 @@
"platforms": {
},
"maintainer": "DataStax",
- "long_description": "= DESCRIPTION:\n\nThis script launches a Apache Cassandra cluster of a predetermined size.\n\nThis has been tested in Ubuntu 10.10 and CentOS 5.5, but should support your version of Ubuntu, CentOS, and RedHat.\n\nThis script will be developed and housed at: https://github.com/riptano/chef.\n\n= REQUIREMENTS:\n\nFollow the instructions as listed here: http://wiki.opscode.com/display/chef/Quick+Start.\n\n== Configure cloud access\n\nProceed to configure your cloud access by adding these following lines to your ~/.chef/knife.rb file.\n\n # Information can be found at: https://manage.rackspacecloud.com/APIAccess.do\n knife[:rackspace_api_username] = \"USER\"\n knife[:rackspace_api_key] = \"KEY\"\n\n # Information can be found at: https://aws-portal.amazon.com/gp/aws/developer/account?ie=UTF8&action=access-key\n knife[:aws_access_key_id] = \"ID\"\n knife[:aws_secret_access_key] = \"KEY\"\n\nPlace this directory into your cookbooks folder.\n\nDownload and place the apt cookbook in your cookbooks folder. \nThe apt recipe can be found here: http://community.opscode.com/cookbooks/apt\n\nThen run:\n\n knife cookbook upload -a -o cookbooks/\n\nYou should see something similar to:\n\n Uploading apt [1.1.2]\n Uploading cassandra [0.1.4]\n Uploading chef-client [0.99.5]\n upload complete\n\n= ATTRIBUTES:\n\nThe main attributes to look can be found at $CHEF_HOME/cookbooks/cassandra/attributes/default.rb and are:\n\n # Needed for the Chef script to function properly\n default[:setup][:deployment] = \"08x\" # Choices are \"07x\", or \"08x\"\n default[:setup][:cluster_size] = 4\n default[:setup][:current_role] = \"cassandra\"\n\n # A unique name is preferred to stop the risk of different clusters joining each other\n default[:cassandra][:cluster_name] = \"Cassandra Cluster\"\n\n # It is best to have the commit log and the data\n # directory on two seperate drives\n default[:cassandra][:commitlog_dir] = \"/var/lib\"\n default[:cassandra][:data_dir] = \"/var/lib\"\n\nFor more information, look over $CHEF_HOME/cookbooks/cassandra/metadata.rb.\n\nTo obtain a free OpsCenter license, please visit: http://www.datastax.com/opscenter.\n\nAfter properly configuring the attributes, upload the cookbook files again by running:\n\n knife cookbook upload -a -o cookbooks/\n\n= USAGE:\n\n== Configure roles\n\nRun this line from your default chef folder:\n\n knife role create cassandra\n\nwhere \"cassandra\" is the value declared as default[:setup][:current_role]. Edit the file to look very similar to this:\n\n {\n \"name\": \"cassandra\",\n \"default_attributes\": {\n },\n \"json_class\": \"Chef::Role\",\n \"env_run_lists\": {\n },\n \"run_list\": [\n \"recipe[cassandra]\" # This is the line of importance\n ],\n \"description\": \"\",\n \"chef_type\": \"role\",\n \"override_attributes\": {\n }\n }\n\nThis 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.\n\n== Ports Needed\n\nA list of the ports required to be open are as follows:\n\n Public Facing:\n Cassandra:\n 9160: Cassandra client port\n 7199: Cassandra JMX port, (8080 in 07x)\n Internal:\n Cassandra:\n 7000: Cassandra intra-node port\n\n== Starting up a cluster\n\nAn Ubuntu 10.10 cloud in Rackspace:\n\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server01 -N Server01\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server02 -N Server02\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server03 -N Server03\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server04 -N Server04\n\nAn Ubuntu 10.10 cloud in EC2:\n\n pemname=<pemFileName> # do not include \".pem\"\n group=<securityGroupName>\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server01\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server02\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server03\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server04\n\nNOTE: These AMIs only work in the US-East region. For all other regions, see http://cloud.ubuntu.com/ami/.\n\nA Debian 6.0 (Squeeze) cloud in Rackspace:\n\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server01 -N Server01\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server02 -N Server02\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server03 -N Server03\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server04 -N Server04\n\nA CentOS 5.5 cloud in Rackspace:\n\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server01 -N Server01\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server02 -N Server02\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server03 -N Server03\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server04 -N Server04\n\nNOTE: 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.\n\n== Bootstrapping Commands\n\nIn 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.\n\nFor an Ubuntu/Debian Machine:\n\n knife bootstrap -r recipe['cassandra'] --sudo -x root <publicDNS>\n\nFor an Ubuntu Machine on EC2:\n\n knife bootstrap -r recipe['cassandra'] --sudo -x ubuntu <publicDNS>\n\nFor a CentOS 5 Machine:\n\n knife bootstrap -r \"recipe['cassandra']\" --sudo -x root -d centos5-gems <publicDNS>\n\nFor a RedHat 5 Machine (Untested):\n\n wget http://goo.gl/0k8mV -O- > ~/.chef/bootstrap/rhel5-rbel.erb\n knife bootstrap --sudo -x root -d rhel5-rbel <publicDNS>\n knife bootstrap -r recipe['cassandra'] --sudo -x root -d rhel5-rbel <publicDNS>\n\n\n== Other Useful Debugging Commands\n\n knife node show Server01 --format json\n knife cookbook metadata cassandra -o cookbooks\n \n",
+ "long_description": "= DESCRIPTION:\n\nThis script launches a Apache Cassandra cluster of a predetermined size.\n\nThis has been tested in Ubuntu 10.10 and CentOS 5.5, but should support your version of Ubuntu, CentOS, and RedHat.\n\nThis script will be developed and housed at: https://github.com/riptano/chef.\n\n= REQUIREMENTS:\n\nFollow the instructions as listed here: http://wiki.opscode.com/display/chef/Quick+Start.\n\n== Configure cloud access\n\nProceed to configure your cloud access by adding these following lines to your ~/.chef/knife.rb file.\n\n # Information can be found at: https://manage.rackspacecloud.com/APIAccess.do\n knife[:rackspace_api_username] = \"USER\"\n knife[:rackspace_api_key] = \"KEY\"\n\n # Information can be found at: https://aws-portal.amazon.com/gp/aws/developer/account?ie=UTF8&action=access-key\n knife[:aws_access_key_id] = \"ID\"\n knife[:aws_secret_access_key] = \"KEY\"\n\nPlace this directory into your cookbooks folder.\n\nDownload and place the apt cookbook in your cookbooks folder. \nThe apt cookbook can be found here: http://community.opscode.com/cookbooks/apt.\n\nThen run:\n\n knife cookbook upload -a -o cookbooks/\n\nYou should see something similar to:\n\n Uploading apt [1.1.2]\n Uploading cassandra [0.1.4]\n Uploading chef-client [0.99.5]\n upload complete\n\n= ATTRIBUTES:\n\nThe main attributes to look can be found at $CHEF_HOME/cookbooks/cassandra/attributes/default.rb and are:\n\n # Needed for the Chef script to function properly\n default[:setup][:deployment] = \"08x\" # Choices are \"07x\", or \"08x\"\n default[:setup][:cluster_size] = 4\n default[:setup][:current_role] = \"cassandra\"\n\n # A unique name is preferred to stop the risk of different clusters joining each other\n default[:cassandra][:cluster_name] = \"Cassandra Cluster\"\n\n # It is best to have the commit log and the data\n # directory on two seperate drives\n default[:cassandra][:commitlog_dir] = \"/var/lib\"\n default[:cassandra][:data_dir] = \"/var/lib\"\n\nFor more information, look over $CHEF_HOME/cookbooks/cassandra/metadata.rb.\n\nTo obtain a free OpsCenter license, please visit: http://www.datastax.com/opscenter.\n\nAfter properly configuring the attributes, upload the cookbook files again by running:\n\n knife cookbook upload -a -o cookbooks/\n\n= USAGE:\n\n== Configure roles\n\nRun this line from your default chef folder:\n\n knife role create cassandra\n\nwhere \"cassandra\" is the value declared as default[:setup][:current_role]. Edit the file to look very similar to this:\n\n {\n \"name\": \"cassandra\",\n \"default_attributes\": {\n },\n \"json_class\": \"Chef::Role\",\n \"env_run_lists\": {\n },\n \"run_list\": [\n \"recipe[cassandra]\" # This is the line of importance\n ],\n \"description\": \"\",\n \"chef_type\": \"role\",\n \"override_attributes\": {\n }\n }\n\nThis 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.\n\n== Ports Needed\n\nThe list of the ports required to be open are as follows:\n\n Public Facing:\n Cassandra:\n 9160: Cassandra client port\n 7199: Cassandra JMX port, (8080 in 07x)\n Internal:\n Cassandra:\n 7000: Cassandra intra-node port\n\n== Starting up a cluster\n\nAn Ubuntu 10.10 cloud in Rackspace (login as root):\n\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server01 -N Server01\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server02 -N Server02\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server03 -N Server03\n knife rackspace server create -r \"role[cassandra]\" -i 69 -f 6 -S Server04 -N Server04\n\nAn Ubuntu 10.10 cloud in EC2 (login as ubuntu):\n\n pemname=<pemFileName> # do not include \".pem\"\n group=<securityGroupName>\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server01\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server02\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server03\n knife ec2 server create -r \"role[cassandra]\" -I ami-08f40561 --flavor m1.large -S $pemname -G $group -x ubuntu -N Server04\n\nNOTE: These AMIs only work in the US-East region. For all other regions, see http://cloud.ubuntu.com/ami/.\n\nA Debian 6.0 (Squeeze) cloud in Rackspace (login as root):\n\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server01 -N Server01\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server02 -N Server02\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server03 -N Server03\n knife rackspace server create -r \"role[cassandra]\" -i 75 -f 6 -S Server04 -N Server04\n\nA CentOS 5.5 cloud in Rackspace (login as root):\n\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server01 -N Server01\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server02 -N Server02\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server03 -N Server03\n knife rackspace server create -r \"role[cassandra]\" -i 51 -f 6 -d centos5-gems -S Server04 -N Server04\n\nNOTE: 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.\n\n== Bootstrapping Commands\n\nIn 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.\n\nFor an Ubuntu/Debian Machine:\n\n knife bootstrap -r recipe['cassandra'] --sudo -x root <publicDNS>\n\nFor an Ubuntu Machine on EC2:\n\n knife bootstrap -r recipe['cassandra'] --sudo -x ubuntu <publicDNS>\n\nFor a CentOS 5 Machine:\n\n knife bootstrap -r \"recipe['cassandra']\" --sudo -x root -d centos5-gems <publicDNS>\n\nFor a RedHat 5 Machine (Untested):\n\n wget http://goo.gl/0k8mV -O- > ~/.chef/bootstrap/rhel5-rbel.erb\n knife bootstrap --sudo -x root -d rhel5-rbel <publicDNS>\n knife bootstrap -r recipe['cassandra'] --sudo -x root -d rhel5-rbel <publicDNS>\n\n\n== Other Useful Debugging Commands\n\n knife node show Server01 --format json\n knife cookbook metadata cassandra -o cookbooks\n \n",
"version": "0.1.4",
"recommendations": {
},
View
3 recipes/install.rb
@@ -20,6 +20,9 @@
action :nothing
end
+# Sets up a user to own the data directories
+node[:internal][:package_user] = "cassandra"
+
# Installs the latest Cassandra 0.7.x
if node[:setup][:deployment] == "07x"
package "cassandra" do
View
4 recipes/write_configs.rb
@@ -15,8 +15,8 @@
execute "sudo mkdir -p #{node[:cassandra][:data_dir]}"
execute "sudo mkdir -p #{node[:cassandra][:commitlog_dir]}"
-execute "sudo chown -R cassandra:cassandra #{node[:cassandra][:data_dir]}"
-execute "sudo chown -R cassandra:cassandra #{node[:cassandra][:commitlog_dir]}"
+execute "sudo chown -R #{node[:internal][:package_user]}:#{node[:internal][:package_user]} #{node[:cassandra][:data_dir]}"
+execute "sudo chown -R #{node[:internal][:package_user]}:#{node[:internal][:package_user]} #{node[:cassandra][:commitlog_dir]}"
ruby_block "buildCassandraEnv" do
block do

0 comments on commit 523e2d6

Please sign in to comment.
Something went wrong with that request. Please try again.