Skip to content

Instantly share code, notes, and snippets.

@matetsu
matetsu / gist:3753806
Created September 20, 2012 03:24
cpanm/build.log
cpanm (App::cpanminus) 1.5018 on perl 5.010001 built for x86_64-linux-thread-multi
Work directory is /root/.cpanm/work/1348110064.19597
You have make /usr/bin/make
You have LWP 6.04
You have /bin/tar: tar (GNU tar) 1.23
Copyright (C) 2010 Free Software Foundation, Inc.
使用許諾 GPLv3+: GNU GPL version 3 またはそれ以降 <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
@matetsu
matetsu / test.sh
Created December 28, 2012 03:43
テスト
#!/bin/sh
echo "test"
@matetsu
matetsu / etc_initd_redis.sh
Created December 28, 2012 03:45
CentOS用Redis起動スクリプト
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@matetsu
matetsu / etc_initd_sentinel.sh
Created December 28, 2012 03:45
CentOS用Sentinel起動スクリプト
#!/bin/sh
#
# sentinel - this script starts and stops the sentinel daemon
#
# chkconfig: - 86 14
# description: Redis Sentinel is monitor and aut-failover for redis.
# processname: redis-sentinel
# config: /etc/redis/sentinel.conf
# config: /etc/sysconfig/redis-sentinel
# pidfile: /var/run/redis-sentinel.pid
@matetsu
matetsu / redis-failover.sh
Created December 28, 2012 03:47
Redisフェイルオーバ時に実行するスクリプト。 要redis-vpc-route-change.py
#!/bin/sh
IPADDR=`LANG=C ifconfig eth0 | sed -n '/.*inet addr:\([0-9.]*\).*/{s//\1/;p}'`
LOCK_FILE="/tmp/redis-failover.lock"
if [ "$#" = "7" ]; then
if [ ! -f ${LOCK_FILE} ]; then
touch ${LOCK_FILE}
if [ "$3" = "end" -a $6 = ${IPADDR} ]; then
/usr/bin/python /usr/local/sbin/redis-vpc-route-change.py
@matetsu
matetsu / redis-slaveof.py
Created December 28, 2012 03:48
Redisにslaveofコマンドを送るためだけのスクリプト。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import redis
import logging
import socket
import traceback
LOGFILE = "/var/log/redis-ha.log"
@matetsu
matetsu / redis-to-master.sh
Created December 28, 2012 03:52
RedisのMasterになるためのスクリプト 要redis-slaveof.py 、 redis-vpc-route-change.py
#!/bin/sh
# redis-to-master.sh
PROG_NAME=$0
HOSTNAME=`hostname -s`
logger -t ${PROG_NAME} "Start changing ${HOSTNAME} to redis master..."
logger -t ${PROG_NAME} "Change this host to master."
# up to master
@matetsu
matetsu / redis-to-slave.sh
Created December 28, 2012 03:54
RedisのMasterホストを指定して、Slaveになるためのスクリプト。 要 redis-slaveof.py
#!/bin/sh
# redis-to-slave.sh
PROG_NAME=$0
HOSTNAME=`hostname -s`
REDIS_PORT=6379
logger -t ${PROG_NAME} "Start changing ${HOSTNAME} to redis slave..."
if [ "$#" != "1" ]; then
@matetsu
matetsu / redis-vpc-route-change.py
Created December 28, 2012 03:56
VPCのroute tableにVIPのルーティング先に自インスタンスIDを指定する。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import boto.ec2
from boto.ec2.connection import EC2Connection
from boto.vpc import VPCConnection
import logging
LOGFILE="/var/log/redis-ha.log"
# AWS CONFIGURATION
@matetsu
matetsu / redis.conf
Created December 28, 2012 03:58
redis.conf ほぼデフォルトで、masterauthとrequireauthの両方に同じパスワードを指定しておく必要あり。
daemonize yes
pidfile /var/run/redis.pid
port 6379
timeout 0
loglevel notice
logfile /var/log/redis.log
databases 16
################################ SNAPSHOTTING #################################
save 900 1