Skip to content

Instantly share code, notes, and snippets.

cat config/client.rb
#
# Chef Client Config File
#
log_level :info
log_location STDOUT
ssl_verify_mode :verify_none
registration_url "http://localhost:4000"
openid_url "http://localhost:4001"
# Divine Panda
service "foo" do
action :nothing
end
template "/etc/foo/config.conf" do
source "config.conf.erb"
action :create
notifies :restart, resources(:service => "foo")
end
# see http://ole-martin.net/hbase-tutorial-for-beginners/
require 'java'
require 'hbase-0.20.2.jar'
require 'lib/zookeeper-3.2.1.jar'
require 'lib/commons-logging-1.0.4.jar'
require 'lib/commons-logging-api-1.0.4.jar'
require 'lib/hadoop-0.20.1-hdfs127-core.jar'
require 'lib/log4j-1.2.15.jar'
#/bin/sh
### What:
# Download and untar the zookeeper distribution and run this to
# create a replicated zookeeper on localhost
## How:
# Create a directory to run servers in
# Copy the zookeeper distribution into it 3x
###
public boolean has_key(String keySpace, String columnFamilyName, String key) throws Exception {
TTransport tr = new TSocket("localhost", 9160);
TProtocol proto = new TBinaryProtocol(tr);
Cassandra.Client client = new Cassandra.Client(proto);
tr.open();
SlicePredicate predicate = new SlicePredicate();
SliceRange sliceRange = new SliceRange();
sliceRange.setCount(1);
sliceRange.setStart(new byte[0]);
[INFO 06-01-2010 22:33:58] Vagrant: [Tue, 01 Jun 2010 22:33:58 -0700] INFO: Installing package[cassandra] version 0.6.2
: stdout
[INFO 06-01-2010 22:34:06] Vagrant: [Tue, 01 Jun 2010 22:34:06 -0700] ERROR: service[cassandra] (/tmp/vagrant-chef/cookbooks-0/cassandra/recipes/default.rb line 30) had an error:
wrong number of arguments (0 for 1)
/usr/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/provider/service.rb:36:in `enable_service'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/provider/service.rb:36:in `action_enable'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/runner.rb:60:in `send'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/runner.rb:60:in `run_action'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/runner.rb:114:in `converge'
/usr/lib/ruby/gems/1.8/gems/chef-0.8.6/bin/../lib/chef/runner.rb:113:in `each'
using
config.vm.customize do |vm|
vm.network_adapters[1].mac_address = "08:00:27:35:33:58"
end
cloudmaster:djest ikallen$ vagrant up
[INFO 06-03-2010 12:19:59] Vagrant: Provisioning enabled with Vagrant::Provisioners::ChefSolo
[INFO 06-03-2010 12:19:59] Vagrant: Importing base VM (/Users/ikallen/.vagrant/boxes/krux_dev_vbox_0_1/box.ovf)...
[INFO 06-03-2010 12:21:15] Vagrant: Persisting the VM UUID (874407ab-e456-466b-a897-bd13d20433ed)...
Vagrant::Config.run do |config|
config.vm.box = "krux_dev_0_1"
config.chef.chef_server_url = "http://192.168.56.103:4000"
config.chef.validation_key_path = "validation.pem"
config.chef.run_list = [ "role[kitchen_sink]" ]
config.vm.provisioner = :chef_server
config.ssh.private_key_path=File.expand_path('~/.ssh/id_rsa-krux-dev-vbox')
config.vm.project_directory = "/krux"
end
[Sat, 12 Jun 2010 04:00:05 +0000] INFO: Creating directory[/etc/sv/data_collection_server] at /etc/sv/data_collection_server
[Sat, 12 Jun 2010 04:00:05 +0000] INFO: Setting mode to 755 for directory[/etc/sv/data_collection_server]
[Sat, 12 Jun 2010 04:00:05 +0000] INFO: Creating directory[/etc/sv/data_collection_server/log] at /etc/sv/data_collection_server/log
[Sat, 12 Jun 2010 04:00:05 +0000] INFO: Setting mode to 755 for directory[/etc/sv/data_collection_server/log]
[Sat, 12 Jun 2010 04:00:05 +0000] INFO: Creating directory[/etc/sv/data_collection_server/log/main] at /etc/sv/data_collection_server/log/main
[Sat, 12 Jun 2010 04:00:05 +0000] INFO: Setting mode to 755 for directory[/etc/sv/data_collection_server/log/main]
[Sat, 12 Jun 2010 04:00:05 +0000] ERROR: template[/etc/sv/data_collection_server/run] (/usr/lib/ruby/gems/1.8/gems/chef-0.8.10/lib/chef/mixin/recipe_definition_dsl_core.rb line 56) had an error:
closed stream
/usr/lib/ruby/1.8/tempfile.rb:167:in `close'
/usr/lib/ruby/1.8/tempfile.rb:167:in `
require 'rubygems'
require 'chef/node'
require 'chef/rest'
# set chef_server_url and node_name & get the path to key file
# look in ~/.chef/knife.rb
Chef::Config[:client_key] = "/path/to/key"
rest = Chef::REST.new(chef_server_url, node_name)
results = rest.get_rest("search/node?q=role:WEBSERVER_ROLE")