Skip to content

Instantly share code, notes, and snippets.

View rhoml's full-sized avatar
WFH

Rhommel Lamas rhoml

WFH
View GitHub Profile
# Documentation for HAProxy
# http://code.google.com/p/haproxy-docs/w/list
# http://haproxy.1wt.eu/download/1.2/doc/architecture.txt
# NOTES:
# open files limits need to be > 256000, use ulimit -n to set (on most POSIX systems)
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
@rhoml
rhoml / OSX List AWS Public DNS on a Security Group
Created May 28, 2013 11:07
Add this to your bash_profile of your OSX profile and enjoy.
publicdns() {
EC2_DESCRIBE_INSTANCES=`which ec2-describe-instances | awk '{print $3}'`
EC2_DESCRIBE_GROUP=`which ec2-describe-group | awk '{print $3}'`
SECURITY_GROUP="$1"
AWS_CERT=~/.ec2/cert.pem
AWS_PK=~/.ec2/pk.pem
echo "This are the Available servers on ${SECURITY_GROUP} security group."
${EC2_DESCRIBE_INSTANCES} -C ${AWS_CERT} -K ${AWS_PK} | grep INSTANCE | grep `${EC2_DESCRIBE_GROUP} -C ${AWS_CERT} -K ${AWS_PK} ${SECURITY_GROUP} | head -1 | awk '{print $2}'` | awk '{print $4 }'
}
@rhoml
rhoml / gist:5441940
Created April 23, 2013 08:57
Launch_ami AWS
#!/bin/bash
#
# USAGE: launch_ami
AMI_ID=ami-xxxx
KEY_ID=xxxxxx
INSTANCE_TYPE="t1.micro"
EC2_RUN_INSTANCES=`which ec2-run-instances`
EC2_DESCRIBE_INSTANCES=`which ec2-describe-instances`
SEC_ID="xxx-xxx"

Keybase proof

I hereby claim:

  • I am rhoml on github.
  • I am rhoml (https://keybase.io/rhoml) on keybase.
  • I have a public key whose fingerprint is 4289 50B6 1986 2303 5CE5 65EF 4D86 1C8B B81D C778

To claim this, I am signing this object:

@rhoml
rhoml / clients.md
Last active August 29, 2015 14:21 — forked from defunkt/clients.md

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support

@rhoml
rhoml / reconfigure.sh
Last active August 29, 2015 14:07
Reconfigure script for Sentinel and Twemproxy
#!/bin/bash
# Simple reconfigure script to modify multiple nutcracker(twemproxy) servers in case of Redis
# Failover.
export PATH=/sbin:/usr/local/bin:$PATH
NAME=sentinel
LOGFILE=/opt/sentinel/logs/reconfigure.log
ERRORLOGFILE=/opt/sentinel/logs/reconfigure.error.log
NUTCRACKER_CONF=/opt/nutcracker/etc/nutcracker.yml
@rhoml
rhoml / sentinel-reconfigure.sh
Created June 5, 2014 07:20
SENTINEL CLIENTS RECONFIGURATION SCRIPT to update twemproxy nutcracker.yml when running 2 twemproxy nodes on the same instance.
#!/bin/bash
export PATH=/sbin:/usr/local/bin:$PATH
NAME=sentinel
LOGFILE=/opt/sentinel/logs/reconfigure.log
ERRORLOGFILE=/opt/sentinel/logs/reconfigure.error.log
NUTCRACKER_CONF=/opt/nutcracker/etc/nutcracker.yml
NUTCRACKERFAILOVER_CONF=/opt/nutcracker/etc/nutcrackerfailover.yml
NUTCRACKER_PORTs='22121,22123'
MASTER_NAME=$1
@rhoml
rhoml / 0_reuse_code.js
Created June 2, 2014 14:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rhoml
rhoml / reconfigure.sh
Last active August 29, 2015 14:01
Reconfigure script for sentinel to update twemproxy when certain redis instance fails.
#!/bin/bash
# <master-name> <role> <state> <from-ip> <from-port> <to-ip> <to-port>
export PATH=/sbin:/usr/local/bin:$PATH
NUTCRACKER_CONF='/opt/nutcracker/conf/nutcracker.yml'
NUTCRACKER_PORT=22121
MASTER_NAME=$1
ROLE=$2
STATE=$3
FROM_IP=$4
FROM_PORT=$5
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#