Skip to content

Instantly share code, notes, and snippets.

View adamhunter's full-sized avatar

Adam Hunter adamhunter

View GitHub Profile
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
# Config for Nginx to act as a front-end for Riak
# The main goal is to proxy all GETs directly to Riak, and disallow anything else (POST, PUT, etc)
# Also, disallow use of the map/reduce query links (i.e. /riak/bucket/key/_,_,_)
# Config is in /etc/nginx/sites-available/default or somewhere like that
# Set up load-balancing to send requests to all nodes in the Riak cluster
# Replace these IPs/ports with the locations of your Riak nodes
upstream riak_hosts {
server 127.0.0.1:8098;
#!/bin/bash
#
# Init file for Riak
# Supports start, stop, restart and status
# chkconfig: 345 96 30
# description: Riak
# Source function library.
#. /etc/init.d/functions
BASE_DIR="/home/riak/current"
create this file in /Library/LaunchDaemons/org.basho.riak.plist
run: sudo launchctl load /Library/LaunchDaemons/org.basho.riak.plist
riak ping to verify
# mongo
def proxy_class
return @proxy_class if defined?(@proxy_class)
@proxy_class =
if many?
if klass.embeddable?
polymorphic? ? ManyEmbeddedPolymorphicProxy : ManyEmbeddedProxy
else
if polymorphic?
describe Ripple::Document::Finders do
include Fixtures::Finders # Box is defined in this module
before :each do
@http = mock("HTTP Backend")
@client = Ripple.client
@client.stub!(:http).and_return(@http)
@bucket = Riak::Bucket.new(@client, "boxes")
@client.stub!(:[]).and_return(@bucket)
#! /bin/bash
### BEGIN INIT INFO
# Provides: riak
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
groupadd mysql
useradd -g mysql mysql
gunzip < mysql-VERSION.tar.gz | tar -xvf -
cd mysql-VERSION
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
-fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql-VERSION --enable-assembler \
--with-mysqld-ldflags=-all-static --with-plugins=innobase
make
adamhunter # i have three nodes in a cluster, how do i remove a node from a cluster?
seancribbs # adamhunter: I had one hang on me earlier, thought it was just Ruby
jlee # adamhunter: are you trying to simulate a failure, or scale the cluster down to two node permanently?
adamhunter # i am trying to figure out if the other two nodes are messing up the first
seancribbs # adamhunter: 0.9?
adamhunter # yeah
seancribbs # use riak_connect:remove_from_cluster/1 in the console, then wait for the handoff to finish
Damm joined #riak
Apr 22 14:52
adamhunter # i clearly must have done something wrong when i installed :) it doesn't work on any of my three nodes, tks
bundle_commands=( spec rspec cucumber cap watchr rails rackup )
function run_bundler_cmd () {
if [ -e ./Gemfile ]; then
echo "bundle exec $@"
bundle exec $@
else
echo "$@"
$@
fi