重温一下,这次找了个简单的安装。
测试过程很顺利哟。
参考URL:
http://www.linuxidc.com/Linux/2015-07/119567.htm
一.介绍
redis在做数据库缓存,session存储,消息队列上用的比较多
二.安装
$ yum install -y wget gcc make tcl
$ wget http://download.redis.io/releases/redis-3.0.2.tar.gz
$ tar zxvf redis-3.0.2.tar.gz
$ cd redis-3.0.2
$ make
$ make test
$ make install
三.配置
$ cp redis.conf /etc/
$ touch /etc/init.d/redis
$ chmod 755 /etc/init.d/redis
$ vi /etc/init.d/redis
(见最后粘的内容)
#记得在redis.conf中修改
daemonize yes
四.运行
$ /etc/init.d/redis start(当然最方便的是service redis start)
$ chkconfig redis on
粘一个SERVICE的脚本:
#!/bin/bash # # Init file for redis # # chkconfig: - 80 12 # description: redis daemon # # processname: redis # config: /etc/redis.conf # pidfile: /var/run/redis.pid source /etc/init.d/functions #BIN="/usr/local/bin" BIN="/usr/local/bin" CONFIG="/etc/redis.conf" PIDFILE="/var/run/redis.pid" ### Read configuration [ -r "$SYSCONFIG" ] && source "$SYSCONFIG" RETVAL=0 prog="redis-server" desc="Redis Server" start() { if [ -e $PIDFILE ];then echo "$desc already running...." exit 1 fi echo -n $"Starting $desc: " daemon $BIN/$prog $CONFIG RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog return $RETVAL } stop() { echo -n $"Stop $desc: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $PIDFILE return $RETVAL } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; condrestart) [ -e /var/lock/subsys/$prog ] && restart RETVAL=$? ;; status) status $prog RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|condrestart|status}" RETVAL=1 esac exit $RETVAL
时间: 2024-10-14 20:29:37