標籤:redis install
安裝部分:
#!/bin/bash
cd /usr/local/src
#wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
tar zxvf tcl8.6.1-src.tar.gz -C /usr/local/
cd cd /usr/local/tcl8.6.1/unix/
./configure
make
make install
cd /usr/local/src
tar zxvf redis-2.8.19.tar.gz
cd redis-2.8.19
make
make install
mkdir -p /usr/local/redis/bin
mkdir -p /usr/local/redis/etc
mkdir -p /usr/local/redis/var
cd /usr/local/bin
cp -pf redis-server /usr/local/redis/bin/
cp -pf redis-check-dump /usr/local/redis/bin/
cp -pf redis-sentinel /usr/local/redis/bin/
cp -pf redis-check-aof /usr/local/redis/bin/
cp -pf redis-cli /usr/local/redis/bin/
cp -pf /home/redis-2.8.19/redis.conf /usr/local/redis/etc
touch /etc/profile.d/redis.sh
cat > /etc/profile.d/redis.sh << EOF
export PATH=$PATH:/usr/local/redis/bin
EOF
mv /usr/local/bin/redis-cli /usr/local/bin/redis-cli.bak
mv /usr/local/bin/redis-server /usr/local/bin/redis-server.bak
mv /usr/local/bin/redis-check-dump /usr/local/bin/redis-check-dump.bak
mv /usr/local/bin/check-aof /usr/local/bin/check-aof.bak
mv /usr/local/bin/tclsh8.6 /usr/local/bin/tclsh8.6.bak
mv /usr/local/bin/benchmark /usr/local/bin/benchmark.bak
mv /usr/local/bin/redis-sentinel /usr/local/bin/redis-sentinel.bak
啟動指令碼:
#!/bin/bash
#
# chkconfig: 2345 90 10
# description: Redis
# redis Startup script for redis processes
#
# author: snowolf
#
# processname: redis
redis_path="/usr/local/redis/bin/redis-server"
redis_conf="/usr/local/redis/etc/redis.conf"
redis_pid="/usr/local/redis/var/run/redis.pid"
# Source function library.
. /etc/rc.d/init.d/functions
[ -x $redis_path ] || exit 0
RETVAL=0
prog="redis"
# Start daemons.
start() {
if [ -e $redis_pid -a ! -z $redis_pid ];then
echo $prog" already running...."
exit 1
fi
echo -n $"Starting $prog "
# Single instance for all caches
$redis_path $redis_conf
RETVAL=$?
[ $RETVAL -eq 0 ] && {
touch /var/lock/subsys/$prog
success $"$prog"
}
echo
return $RETVAL
}
# Stop daemons.
stop() {
echo -n $"Stopping $prog "
killproc -d 10 $redis_path
echo
[ $RETVAL = 0 ] && rm -f $redis_pid /var/lock/subsys/$prog
RETVAL=$?
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if test "x`pidof redis`" != x; then
stop
start
fi
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
exit 1
esac
exit $RETVAL
本文出自 “常用文檔” 部落格,請務必保留此出處http://yujianglei.blog.51cto.com/7215578/1600805
redis-2.8.19.tar.gz 安裝和啟動指令碼