Skip to content

Instantly share code, notes, and snippets.

@mt3
mt3 / gist:3888551
Created October 14, 2012 13:20 — forked from clintongormley/gist:3888120
Upgrading a running elasticsearch cluster

Yesterday I upgraded our running elasticsearch cluster on a site which serves a few million search requests a day, with zero downtime. I've been asked to describe the process, hence this blogpost.

To make it more complicated, the cluster was running elasticsearch version 0.17.8 (released 6 Oct 2011) and I upgraded it to the latest 0.19.10. There have been 21 releases between those two versions, with a lot of functional changes, so I needed to be ready to roll back if necessary.

Our setup:

  • elasticsearch

We run elasticsearch on two biggish boxes: 16 cores plus 32GB of RAM. All indices have 1 replica, so all data is stored on both boxes (about 45GB of data). The primary data for our main indices is also stored in our database. We have a few other indices whose data is stored only in elasticsearch, but are updated once daily only. Finally, we store our sessions in elasticsearch, but active sessions are cached in memcached.

@mt3
mt3 / gist:3926204
Created October 21, 2012 07:00 — forked from irace/gist:1041837
Simple bookmarklet template with jQuery
// Stripped down jQuerify for modern browsers: http://www.learningjquery.com/2009/04/better-stronger-safer-jquerify-bookmarklet
(function() {
var f = function() {
jQuery.noConflict()(function($) {
// Bookmarklet code goes here
});
};
if (typeof jQuery != 'undefined') {
@mt3
mt3 / gist:3926205
Created October 21, 2012 07:01 — forked from irace/gist:3366283
Git cheat sheet
# Checkout remote branch
git checkout -t origin/<branch>
# Delete branch (local, remote)
git branch -d <branch>
git push origin --delete <branch>
# Submodules
git submodule init
git submodule update
@mt3
mt3 / watcher.py
Created October 22, 2012 10:20 — forked from jonathansick/watcher.py
Run make whenever a LaTeX file is modified (using Python watchdog)
import subprocess
import os
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class ChangeHandler(FileSystemEventHandler):
"""React to modified .tex files."""
@mt3
mt3 / fabfile.py
Created November 2, 2012 14:12 — forked from reinout/fabfile.py
Fabfile I use for http://reinout.vanrees.org/weblog/2012/10/30/vagrant-osx-how.html, pretty unfiltered work in progress.
from fabric.context_managers import cd
from fabric.contrib.files import exists
from fabric.decorators import hosts
from fabric.decorators import task
from fabric.operations import run
from fabric.operations import sudo
PACKAGES = [
# 'python-mapnik',
'binutils',
@mt3
mt3 / README.md
Created November 4, 2012 13:22 — forked from agnoster/README.md
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@mt3
mt3 / vim-plugin-installer.sh
Created November 9, 2012 10:39 — forked from jeetsukumaran/vim-plugin-installer.sh
Script to install Vim plugin from its development source
#! /bin/bash
if [[ -z $1 ]]
then
if [[ -z $VIMRUNTIME ]]
then
VIMRUNTIME=$HOME/.vim
fi
else
VIMRUNTIME="$1"
@mt3
mt3 / vim-conf-makedist.sh
Created November 9, 2012 10:39 — forked from jeetsukumaran/vim-conf-makedist.sh
Create an Archive of Your Vim Configuration/Setup for Deployment on Other Machines
#! /bin/bash
function usage {
echo "`basename $0` [OPTIONS] [OUTPUT-PREFIX]"
echo "Archives Vim installation."
echo " "
echo "Options:"
echo " --windows ... build distributable for MS Windows system"
echo " -h|--help ... show help"
exit 1
tell application "Safari" to set recipeurl to URL of front document
tell application "Safari" to set recipetitle to name of front document
set ingredients to (do shell script "curl http://recipedistiller.com/recipe/classify/?recipeurl=" & recipeurl & " | textutil -convert txt -stdin -stdout | grep '.' | sed 's/ • DELETE //g'")
set my text item delimiters to "VIEW RECIPE"
set ingredients to text item 2 of ingredients
set my text item delimiters to "©"
set ingredients to text item 1 of ingredients
#!/usr/bin/env python
# A quick and dirty script to rename a pinboard.in tag.
# I'll probably update this become a proper command line app one day
import urllib2
import pinboard
pinuser = ""
pinpasswd = ""