From 912b891ca07160a56924e91db92e8b4d40aa1175 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 12 Sep 2014 18:09:08 +0200 Subject: redis: 2.8.15 --- redis-2.8.10-conf.patch | 44 ------------------------- redis-2.8.15-conf.patch | 44 +++++++++++++++++++++++++ redis-sentinel.init | 88 +++++++++++++++++++++++++++++++++++++++++++++++++ redis-sentinel.service | 13 ++++++++ redis-shutdown | 28 ++++++++++++++++ redis.init | 4 +-- redis.service | 7 ++-- redis.spec | 27 +++++++++------ sentinel.init | 88 ------------------------------------------------- sentinel.service | 12 ------- 10 files changed, 196 insertions(+), 159 deletions(-) delete mode 100644 redis-2.8.10-conf.patch create mode 100644 redis-2.8.15-conf.patch create mode 100644 redis-sentinel.init create mode 100644 redis-sentinel.service create mode 100644 redis-shutdown delete mode 100644 sentinel.init delete mode 100644 sentinel.service diff --git a/redis-2.8.10-conf.patch b/redis-2.8.10-conf.patch deleted file mode 100644 index 77c2696..0000000 --- a/redis-2.8.10-conf.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -up redis-2.8.10/redis.conf.rpmconf redis-2.8.10/redis.conf ---- redis-2.8.10/redis.conf.rpmconf 2014-06-05 11:02:23.000000000 +0200 -+++ redis-2.8.10/redis.conf 2014-06-06 17:10:07.493834288 +0200 -@@ -62,6 +62,7 @@ tcp-backlog 511 - # - # 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 -@@ -100,7 +101,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 +185,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 -up redis-2.8.10/sentinel.conf.rpmconf redis-2.8.10/sentinel.conf ---- redis-2.8.10/sentinel.conf.rpmconf 2014-06-06 17:10:07.493834288 +0200 -+++ redis-2.8.10/sentinel.conf 2014-06-06 17:12:17.168324319 +0200 -@@ -4,6 +4,11 @@ - # The port that this sentinel instance will run on - port 26379 - -+# 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 /var/log/redis/sentinel.log -+ - # dir - # Every long running process should have a well-defined working directory. - # For Redis Sentinel to chdir to /tmp at startup is the simplest thing diff --git a/redis-2.8.15-conf.patch b/redis-2.8.15-conf.patch new file mode 100644 index 0000000..fc5e343 --- /dev/null +++ b/redis-2.8.15-conf.patch @@ -0,0 +1,44 @@ +diff -up redis-2.8.15/redis.conf.rpmconf redis-2.8.15/redis.conf +--- redis-2.8.15/redis.conf.rpmconf 2014-09-12 16:16:58.000000000 +0200 ++++ redis-2.8.15/redis.conf 2014-09-12 17:46:45.918482580 +0200 +@@ -62,6 +62,7 @@ tcp-backlog 511 + # + # 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 +@@ -100,7 +101,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 +185,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 -up redis-2.8.15/sentinel.conf.rpmconf redis-2.8.15/sentinel.conf +--- redis-2.8.15/sentinel.conf.rpmconf 2014-09-12 17:46:45.918482580 +0200 ++++ redis-2.8.15/sentinel.conf 2014-09-12 17:47:39.512717702 +0200 +@@ -4,6 +4,11 @@ + # The port that this sentinel instance will run on + port 26379 + ++# 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 /var/log/redis/sentinel.log ++ + # sentinel announce-ip + # sentinel announce-port + # diff --git a/redis-sentinel.init b/redis-sentinel.init new file mode 100644 index 0000000..115f65b --- /dev/null +++ b/redis-sentinel.init @@ -0,0 +1,88 @@ +#!/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" +pidfile="/var/run/redis/sentinel.pid" +REDIS_CONFIG="/etc/redis-sentinel.conf" + +[ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel + +lockfile=/var/lock/subsys/redis + +start() { + [ -f $REDIS_CONFIG ] || exit 6 + [ -x $exec ] || exit 5 + echo -n $"Starting $name: " + daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile" + 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..ff3a117 --- /dev/null +++ b/redis-sentinel.service @@ -0,0 +1,13 @@ +[Unit] +Description=Redis Sentinel +After=network.target + +[Service] +ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --daemonize no +ExecStop=/usr/bin/redis-shutdown sentinel +User=redis +Group=redis + +[Install] +WantedBy=multi-user.target + diff --git a/redis-shutdown b/redis-shutdown new file mode 100644 index 0000000..1bf0e16 --- /dev/null +++ b/redis-shutdown @@ -0,0 +1,28 @@ +#!/bin/bash +# +# Wrapper to close properly redis and sentinel +test x"REDIS_DEBUG" != x && set -x + +REDIS_CLI=/usr/bin/redis-cli + +# Retrieve service name +SERVICE_NAME="$2" +if [ -z "$SERVICE_NAME" ]; then + SERVICE_NAME=redis +fi + +# Get the proper config file based on service name +CONFIG_FILE="/etc/$SERVICE_NAME.conf" + +# Use awk to retrieve port from config file +PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE` + +# Just in case, use default port +if [ "$SERVICE_NAME" = redis ]; then + PORT=${PORT:-6379} +else + PORT=${PORT:-26739} +fi + +# shutdown the service properly +$REDIS_CLI -p $PORT shutdown \ No newline at end of file diff --git a/redis.init b/redis.init index f100f9f..0479769 100644 --- a/redis.init +++ b/redis.init @@ -9,7 +9,7 @@ . /etc/rc.d/init.d/functions name="redis-server" -exec="/usr/sbin/$name" +exec="/usr/bin/$name" pidfile="/var/run/redis/redis.pid" REDIS_CONFIG="/etc/redis.conf" @@ -21,7 +21,7 @@ start() { [ -f $REDIS_CONFIG ] || exit 6 [ -x $exec ] || exit 5 echo -n $"Starting $name: " - daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile" + daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile" retval=$? echo [ $retval -eq 0 ] && touch $lockfile diff --git a/redis.service b/redis.service index c7bb48a..1c549b4 100644 --- a/redis.service +++ b/redis.service @@ -1,9 +1,10 @@ [Unit] -Description=A persistent key-value database -After=syslog.target network.target +Description=Redis persistent key-value database +After=network.target [Service] -ExecStart=/usr/sbin/redis-server /etc/redis.conf --daemonize no +ExecStart=/usr/bin/redis-server /etc/redis.conf --daemonize no +ExecStop=/usr/bin/redis-shutdown User=redis Group=redis diff --git a/redis.spec b/redis.spec index 50ce0bf..49d6c52 100644 --- a/redis.spec +++ b/redis.spec @@ -10,7 +10,7 @@ %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: redis -Version: 2.8.14 +Version: 2.8.15 Release: 1%{?dist} Summary: A persistent key-value database @@ -22,10 +22,11 @@ Source1: %{name}.logrotate Source2: %{name}.init Source3: %{name}.service Source4: %{name}.tmpfiles -Source5: sentinel.init -Source6: sentinel.service +Source5: %{name}-sentinel.init +Source6: %{name}-sentinel.service +Source7: %{name}-shutdown # Update configuration for Fedora -Patch0: %{name}-2.8.10-conf.patch +Patch0: %{name}-2.8.15-conf.patch Patch1: %{name}-deps-PIC.patch Patch2: %{name}-deps-unbundle-jemalloc.patch @@ -35,6 +36,8 @@ BuildRequires: tcl >= 8.5 %endif BuildRequires: jemalloc-devel +# Required for redis-shutdown +Requires: /bin/awk Requires: logrotate Requires(pre): shadow-utils %if %{with_systemd} @@ -117,13 +120,12 @@ install -p -D -m 755 %{SOURCE5} %{buildroot}%{_initrddir}/%{name}-sentinel # Fix non-standard-executable-perm error chmod 755 %{buildroot}%{_bindir}/%{name}-* -# Ensure redis-server location doesn't change -mkdir -p %{buildroot}%{_sbindir} -mv %{buildroot}%{_bindir}/%{name}-server %{buildroot}%{_sbindir}/%{name}-server - # create redis-sentinel command as described on # http://redis.io/topics/sentinel -ln -s %{name}-server %{buildroot}%{_sbindir}/%{name}-sentinel +ln -s %{name}-server %{buildroot}%{_bindir}/%{name}-sentinel + +# Install redis-shutdown +install -pDm755 %{SOURCE7} %{buildroot}%{_bindir}/%{name}-shutdown %post @@ -202,7 +204,6 @@ fi %dir %attr(0755, redis, root) %{_localstatedir}/log/%{name} %dir %attr(0755, redis, root) %{_localstatedir}/run/%{name} %{_bindir}/%{name}-* -%{_sbindir}/%{name}-* %if %{with_systemd} %{_prefix}/lib/tmpfiles.d/%{name}.conf %{_unitdir}/%{name}.service @@ -214,6 +215,12 @@ fi %changelog +* Fri Sep 12 2014 Remi Collet - 2.8.15-1 +- Redis 2.8.15 - Release date: 12 Sep 2014 + upgrade urgency: LOW for Redis, HIGH for Sentinel. +- move commands from /usr/sbin to /usr/bin +- add redis-shutdown command (systemd) + * Thu Sep 4 2014 Remi Collet - 2.8.14-1 - Redis 2.8.14 - Release date: 1 Sep 2014 upgrade urgency: HIGH for Lua scripting users, otherwise LOW. diff --git a/sentinel.init b/sentinel.init deleted file mode 100644 index 0ed325b..0000000 --- a/sentinel.init +++ /dev/null @@ -1,88 +0,0 @@ -#!/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/sbin/$name" -pidfile="/var/run/redis/sentinel.pid" -REDIS_CONFIG="/etc/redis-sentinel.conf" - -[ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel - -lockfile=/var/lock/subsys/redis - -start() { - [ -f $REDIS_CONFIG ] || exit 6 - [ -x $exec ] || exit 5 - echo -n $"Starting $name: " - daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile" - 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/sentinel.service b/sentinel.service deleted file mode 100644 index 487f283..0000000 --- a/sentinel.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Redis sentinel -After=syslog.target network.target - -[Service] -ExecStart=/usr/sbin/redis-sentinel /etc/redis-sentinel.conf --daemonize no -User=redis -Group=redis - -[Install] -WantedBy=multi-user.target - -- cgit