Centos6.6 安装Redis
jopen
9年前
一.介绍
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 #!/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 #记得在redis.conf中修改 daemonize yes
四.运行
$ /etc/init.d/redis start $ chkconfig redis on
五.检查