Skip to content

Instantly share code, notes, and snippets.

@pcn
pcn / gist:1607780
Created January 13, 2012 17:54
Example grover cluster definition
cluster_type = 'Grover'
differentiator = 'test'
# cluster_name = "#{cluster_type}_#{differentiator}"
cluster_name = "Grover"
require "Chef"
data = Chef::DataBagItem.load('cluster_template_values', cluster_type)['default']
ClusterChef.cluster cluster_name do
recipe "tuning"
@pcn
pcn / upload_aws_ssh_key.py
Created January 13, 2012 18:16
Code to upload an ssh public key to aws when we need a keypair with a different name
#!/usr/bin/env python
# To create a cluster using cluster_chef, an ssh key must exist with
# that cluster name in EC2/AWS. Since we use generic keys, it makes
# sense to continue to use a per-account key, but to upload that key
# to AWS as needed.
#
# E.g. .ssh/FOO-utility.pub can be uploaded to EC2 as UtilityCluster
# to enable a cluster called UtilityCluster to be bootstrapped.
@pcn
pcn / gist:1650568
Created January 21, 2012 01:05
java backtrace trying to get cassandra started with seeds
ubuntu@domU-12-31-39-0F-76-61:/usr/share/cassandra$ sudo /etc/sv/cassandra/run
/etc/sv/cassandra/run: 32: source: not found
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 12345; nested exception is:
java.net.BindException: Address already in use
ubuntu@domU-12-31-39-0F-76-61:/usr/share/cassandra$ sudo /etc/sv/cassandra/run
/etc/sv/cassandra/run: 32: source: not found
Error: Exception thrown by the agent : java.rmi.server.ExportException: Port already in use: 12345; nested exception is:
java.net.BindException: Address already in use
@pcn
pcn / gist:2230952
Created March 28, 2012 22:03
patch knewton bootstrap
diff --git a/lib/chef/knife/bootstrap/ubuntu11.04-cluster_chef_knewton.erb b/lib/chef/knife/bootstrap/ubuntu11.04-cluster_chef_knewton.erb
index fcbba02..9ac69b3 100644
--- a/lib/chef/knife/bootstrap/ubuntu11.04-cluster_chef_knewton.erb
+++ b/lib/chef/knife/bootstrap/ubuntu11.04-cluster_chef_knewton.erb
@@ -237,6 +237,10 @@ service chef-client stop
service chef-client disable
<%- if (@config[:bootstrap_runs_chef_client].to_s == 'true') || (@chef_config.knife[:bootstrap_runs_chef_client].to_s == 'true') %>
+if [ "$APT_UPDATED" != "yes" ] ; then
+ echo -e "`date` \n\n**** \n**** apt update:\n****\n"
@pcn
pcn / logback.conf
Created May 24, 2012 17:31
trying for a logstash conf file that works with java's logback logger
input {
# file {
# path => ["/var/log/knewton/*/*.log"]
# type => "knewton_logback"
# }
stdin {
type => "knewton_logback"
}
}
input {
file {
path => ["/var/log/knewton/*/*.log"]
type => "knewton_logback"
}
}
filter {
grok {
type => "knewton_logback"
@pcn
pcn / command_i_ran
Created June 1, 2012 05:43
Trying to use shell_out in a chef recipe
sudo chef-solo -l debug -c solo.rb -j node-cassandra.json -L /var/log/chef/solo.log -r /tmp/Systems-0.0.2.tar.gz
@pcn
pcn / client_logstash_agent.conf
Created June 10, 2012 03:17
logstash message
# Default config example from:
# - http://logstash.net/docs/1.0.14/getting-started-simple
# XXX: add platform knowledge to tag messages
input {
file {
path => ["/var/log/knewton/*/*.log"]
type => "knewton_logback"
}
file {
path => ["/var/log/knewton/Spiky/current",
@pcn
pcn / chef_run_output
Created June 14, 2012 21:03
unhelpful stacktrace output
pn@ip-10-28-30-172:/var/tmp$ sudo /usr/bin/chef-solo -l debug -c solo.rb -j node-jettyperf.json -L /var/log/chef/solo.log -r /tmp/Systems-0.0.9.tar.gz
[Thu, 14 Jun 2012 21:01:35 +0000] DEBUG: Creating path /var/tmp to extract recipes into
[Thu, 14 Jun 2012 21:01:35 +0000] DEBUG: Executing tar zxvfC /var/tmp/recipes.tgz /var/tmp
[Thu, 14 Jun 2012 21:01:35 +0000] DEBUG: ---- Begin output of tar zxvfC /var/tmp/recipes.tgz /var/tmp ----
[Thu, 14 Jun 2012 21:01:35 +0000] DEBUG: STDOUT: cookbooks/
cookbooks/apt/
cookbooks/bib/
cookbooks/big_log_dir/
cookbooks/cassandra/
cookbooks/diamond/
@pcn
pcn / jmap_histogram
Created June 21, 2012 03:47
jmap and thread dump of logstash on kpip
Object Histogram:
num #instances #bytes Class description
--------------------------------------------------------------------------
1: 14024 25627952 int[]
2: 43063 7176744 * ConstMethodKlass
3: 6309 5812704 * InstanceKlassKlass
4: 43063 5176584 * MethodKlass
5: 6309 4924416 * ConstantPoolKlass
6: 64122 3206440 * SymbolKlass