Browse Source

redis add missing source files

Signed-off-by: nosqlbuilder_pel7ppc64bebuilder0 <nosqlbuilder@powerel.org>
master
nosqlbuilder_pel7ppc64bebuilder0 6 years ago
parent
commit
356748ebf4
  1. 2
      SOURCES/macros.redis
  2. 6
      SOURCES/redis-limit-init
  3. 7
      SOURCES/redis-limit-systemd
  4. 94
      SOURCES/redis-sentinel.init
  5. 16
      SOURCES/redis-sentinel.service
  6. 40
      SOURCES/redis-shutdown
  7. 9
      SOURCES/redis.logrotate
  8. 16
      SOURCES/redis.service

2
SOURCES/macros.redis

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
%redis_modules_abi 1
%redis_modules_dir %{_libdir}/redis/modules

6
SOURCES/redis-limit-init

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the value below
# see "man limits.conf" for information
redis soft nofile 10240
redis hard nofile 10240

7
SOURCES/redis-limit-systemd

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the LimitNOFILE value below
# see "man systemd.exec" for information

[Service]
LimitNOFILE=10240

94
SOURCES/redis-sentinel.init

@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
#!/bin/sh
#
# redis init file for starting up the redis-sentinel daemon
#
# chkconfig: - 21 79
# description: Starts and stops the redis-sentinel daemon.
#
### BEGIN INIT INFO
# Provides: redis-sentinel
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Short-Description: start and stop Sentinel server
# Description: A persistent key-value database
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

name="redis-sentinel"
exec="/usr/bin/$name"
shut="/usr/libexec/redis-shutdown"
pidfile="/var/run/redis/sentinel.pid"
SENTINEL_CONFIG="/etc/redis-sentinel.conf"

[ -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: "
daemon --user ${REDIS_USER-redis} "$exec $SENTINEL_CONFIG --daemonize yes --pidfile $pidfile"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}

stop() {
echo -n $"Stopping $name: "
[ -x $shut ] && $shut $name
retval=$?
if [ -f $pidfile ]
then
# shutdown haven't work, try old way
killproc -p $pidfile $name
retval=$?
else
success "$name shutdown"
fi
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}

restart() {
stop
start
}

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
;;
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 $?

16
SOURCES/redis-sentinel.service

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
[Unit]
Description=Redis Sentinel
After=network.target

[Service]
ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --supervised systemd
ExecStop=/usr/libexec/redis-shutdown redis-sentinel
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target

40
SOURCES/redis-shutdown

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
#!/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="$1"
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 host, port from config file
HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE | tail -n1`
PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE | tail -n1`
PASS=`awk '/^[[:blank:]]*requirepass/ { print $2 }' $CONFIG_FILE | tail -n1`
SOCK=`awk '/^[[:blank:]]*unixsocket\s/ { print $2 }' $CONFIG_FILE | tail -n1`

# Just in case, use default host, port
HOST=${HOST:-127.0.0.1}
if [ "$SERVICE_NAME" = redis ]; then
PORT=${PORT:-6379}
else
PORT=${PORT:-26739}
fi

# Setup additional parameters
# e.g password-protected redis instances
[ -z "$PASS" ] || ADDITIONAL_PARAMS="-a $PASS"

# shutdown the service properly
if [ -e "$SOCK" ] ; then
$REDIS_CLI -s $SOCK $ADDITIONAL_PARAMS shutdown
else
$REDIS_CLI -h $HOST -p $PORT $ADDITIONAL_PARAMS shutdown
fi

9
SOURCES/redis.logrotate

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
/var/log/redis/*.log {
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
}

16
SOURCES/redis.service

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
[Unit]
Description=Redis persistent key-value database
After=network.target

[Service]
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
ExecStop=/usr/libexec/redis-shutdown
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target

Loading…
Cancel
Save