diff --git a/redis-2.8.11-deps-library-fPIC-performance-tuning.patch b/redis-2.8.11-deps-library-fPIC-performance-tuning.patch new file mode 100644 index 0000000..7da8bcc --- /dev/null +++ b/redis-2.8.11-deps-library-fPIC-performance-tuning.patch @@ -0,0 +1,26 @@ +Index: redis-2.8.11/deps/Makefile +=================================================================== +--- redis-2.8.11.orig/deps/Makefile ++++ redis-2.8.11/deps/Makefile +@@ -58,7 +58,7 @@ ifeq ($(uname_S),SunOS) + LUA_CFLAGS= -D__C99FEATURES__=1 + endif + +-LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS) ++LUA_CFLAGS+= -O2 -Wall -DLUA_ANSI $(CFLAGS) -fPIC + LUA_LDFLAGS+= $(LDFLAGS) + + lua: .make-prerequisites +Index: redis-2.8.11/deps/linenoise/Makefile +=================================================================== +--- redis-2.8.11.orig/deps/linenoise/Makefile ++++ redis-2.8.11/deps/linenoise/Makefile +@@ -2,7 +2,7 @@ STD= + WARN= -Wall + OPT= -Os + +-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) ++R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -fPIC + R_LDFLAGS= $(LDFLAGS) + DEBUG= -g + diff --git a/redis-2.8.11-disable-test-failed-on-slow-machine.patch b/redis-2.8.11-disable-test-failed-on-slow-machine.patch new file mode 100644 index 0000000..bd43f6f --- /dev/null +++ b/redis-2.8.11-disable-test-failed-on-slow-machine.patch @@ -0,0 +1,12 @@ +Index: redis-2.8.11/tests/test_helper.tcl +=================================================================== +--- redis-2.8.11.orig/tests/test_helper.tcl ++++ redis-2.8.11/tests/test_helper.tcl +@@ -33,7 +33,6 @@ set ::all_tests { + integration/replication-2 + integration/replication-3 + integration/replication-4 +- integration/replication-psync + integration/aof + integration/rdb + integration/convert-zipmap-hash-on-load diff --git a/redis-2.8.11-redis-conf-location-variables.patch b/redis-2.8.11-redis-conf-location-variables.patch new file mode 100644 index 0000000..47e70f3 --- /dev/null +++ b/redis-2.8.11-redis-conf-location-variables.patch @@ -0,0 +1,54 @@ +Index: redis-2.8.11/redis.conf +=================================================================== +--- redis-2.8.11.orig/redis.conf ++++ redis-2.8.11/redis.conf +@@ -34,11 +34,11 @@ + + # By default Redis does not run as a daemon. Use 'yes' if you need it. + # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. +-daemonize no ++daemonize yes + + # When running daemonized, Redis writes a pid file in /var/run/redis.pid by + # default. You can specify a custom pid file location here. +-pidfile /var/run/redis.pid ++pidfile /var/run/redis/redis.pid + + # Accept connections on the specified port, default is 6379. + # If port 0 is specified Redis will not listen on a TCP socket. +@@ -61,7 +61,7 @@ tcp-backlog 511 + # Examples: + # + # bind 192.168.1.100 10.0.0.1 +-# bind 127.0.0.1 ++bind 127.0.0.1 + + # Specify the path for the Unix socket that will be used to listen for + # incoming connections. There is no default, so Redis will not listen +@@ -87,7 +87,7 @@ timeout 0 + # On other kernels the period depends on the kernel configuration. + # + # A reasonable value for this option is 60 seconds. +-tcp-keepalive 0 ++tcp-keepalive 60 + + # Specify the server verbosity level. + # This can be one of: +@@ -100,7 +100,7 @@ loglevel notice + # Specify the log file name. Also the empty string can be used to force + # Redis to log on the standard output. Note that if you use standard + # output for logging but daemonize, logs will be sent to /dev/null +-logfile "" ++logfile /var/log/redis/redis.log + + # To enable logging to the system logger, just set 'syslog-enabled' to yes, + # and optionally update the other syslog parameters to suit your needs. +@@ -184,7 +184,7 @@ dbfilename dump.rdb + # The Append Only File will also be created inside this directory. + # + # Note that you must specify a directory here, not a file name. +-dir ./ ++dir /var/lib/redis/ + + ################################# REPLICATION ################################# + diff --git a/redis-2.8.11-use-system-jemalloc.patch b/redis-2.8.11-use-system-jemalloc.patch new file mode 100644 index 0000000..5da3d68 --- /dev/null +++ b/redis-2.8.11-use-system-jemalloc.patch @@ -0,0 +1,15 @@ +Index: redis-2.8.11/src/Makefile +=================================================================== +--- redis-2.8.11.orig/src/Makefile ++++ redis-2.8.11/src/Makefile +@@ -84,8 +84,8 @@ endif + + ifeq ($(MALLOC),jemalloc) + DEPENDENCY_TARGETS+= jemalloc +- FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include +- FINAL_LIBS+= ../deps/jemalloc/lib/libjemalloc.a -ldl ++ FINAL_CFLAGS+= -DUSE_JEMALLOC -DJEMALLOC_NO_DEMANGLE -I/usr/include/jemalloc ++ FINAL_LIBS+= -ljemalloc -ldl + endif + + REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) diff --git a/redis-sentinel.init b/redis-sentinel.init new file mode 100644 index 0000000..f50f05a --- /dev/null +++ b/redis-sentinel.init @@ -0,0 +1,93 @@ +#!/bin/sh +# +# redis init file for starting up the redis-sentinel daemon +# +# chkconfig: - 21 79 +# description: Starts and stops the redis-sentinel daemon. + +# Source function library. +. /etc/rc.d/init.d/functions + +NAME="redis-sentinel" +EXEC="/usr/bin/$NAME" +SENTINEL_CONFIG="/etc/redis-sentinel.conf" +RUNDIR="/var/run/redis" +PIDFILE="$RUNDIR/redis-sentinel.pid" + +[ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel + +lockfile=/var/lock/subsys/redis + +start() { + [ -f $SENTINEL_CONFIG ] || exit 6 + [ -x $EXEC ] || exit 5 + echo -n $"Starting $NAME: " + mkdir -p $RUNDIR + touch $PIDFILE + chown redis:redis $RUNDIR $PIDFILE + chmod 750 $RUNDIR + daemon --user ${REDIS_USER-redis} --pidfile=$PIDFILE "$EXEC $SENTINEL_CONFIG --sentinel" + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $NAME: " + killproc -p $PIDFILE $NAME + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + false +} + +rh_status() { + status -p $PIDFILE $NAME +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}" + exit 2 +esac +exit $? diff --git a/redis-sentinel.service b/redis-sentinel.service new file mode 100644 index 0000000..faa0eb6 --- /dev/null +++ b/redis-sentinel.service @@ -0,0 +1,13 @@ +[Unit] +Description=Redis Sentinel +After=network.target + +[Service] +ExecStartPre=/usr/bin/mkdir -p /var/lib/redis +ExecStart=/usr/sbin/redis-sentinel /etc/sentinel.conf +ExecStop=/usr/bin/redis-cli shutdown +User=redis +Group=redis + +[Install] +WantedBy=multi-user.target diff --git a/redis-server.init b/redis-server.init new file mode 100644 index 0000000..0a3d318 --- /dev/null +++ b/redis-server.init @@ -0,0 +1,93 @@ +#!/bin/sh +# +# redis init file for starting up the redis daemon +# +# chkconfig: - 20 80 +# description: Starts and stops the redis daemon. + +# Source function library. +. /etc/rc.d/init.d/functions + +NAME="redis-server" +EXEC="/usr/bin/$NAME" +REDIS_CONFIG="/etc/redis.conf" +RUNDIR="/var/run/redis" +PIDFILE="$RUNDIR/redis.pid" + +[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis + +lockfile=/var/lock/subsys/redis + +start() { + [ -f $REDIS_CONFIG ] || exit 6 + [ -x $EXEC ] || exit 5 + echo -n $"Starting $NAME: " + mkdir -p $RUNDIR + touch $PIDFILE + chown redis:redis $RUNDIR $PIDFILE + chmod 750 $RUNDIR + daemon --user ${REDIS_USER-redis} "$EXEC $REDIS_CONFIG" + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $NAME: " + killproc -p $PIDFILE $NAME + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + false +} + +rh_status() { + status -p $PIDFILE $NAME +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}" + exit 2 +esac +exit $? diff --git a/redis-server.service b/redis-server.service new file mode 100644 index 0000000..6d7a5f5 --- /dev/null +++ b/redis-server.service @@ -0,0 +1,13 @@ +[Unit] +Description=Redis persistent key-value database +After=network.target + +[Service] +ExecStartPre=/usr/bin/mkdir -p /var/lib/redis +ExecStart=/usr/sbin/redis-server /etc/redis.conf +ExecStop=/usr/bin/redis-cli shutdown +User=redis +Group=redis + +[Install] +WantedBy=multi-user.target