Linux下安装redis
Posted lzhbkjava
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux下安装redis相关的知识,希望对你有一定的参考价值。
-
-
下载解压 redis wget http://download.redis.io/releases/redis-3.0.0.tar.gz tar zxvf redis-3.0.0.tar.gz cd redis-3.0.0
-
进入redis目录,执行make; make MALLOC=libc
-
启动 关闭 redis
-
启动redis src/redis-server &
-
关闭redis src/redis-cli shutdown
-
-
redis 开机启动 —— 创建链接 ln -s /usr/redis.3.0.0 /usr/redis —— 修改 redis.config
daemonize yes
vi /etc/init.d/redis
# chkconfig: 2345 10 90 # description: Start and Stop redis PATH=/usr/local/bin:/sbin:/usr/bin:/bin REDISPORT=6379 EXEC=/usr/redis/src/redis-server REDIS_CLI=/usr/redis/src/redis-cli PIDFILE=/var/run/redis.pid CONF="/use/redis/redis.conf" AUTH="1234" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed." else echo "Starting Redis server..." $EXEC $CONF fi if [ "$?"="0" ] then echo "Redis is running..." fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE exists, process is not running." else PID=$(cat $PIDFILE) echo "Stopping..." $REDIS_CLI -p $REDISPORT SHUTDOWN sleep 2 while [ -x $PIDFILE ] do echo "Waiting for Redis to shutdown..." sleep 1 done echo "Redis stopped" fi ;; restart|force-reload) ${0} stop ${0} start ;; *) echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2 exit 1 esac
-
尝试启动或停止redisservice redis startservice redis stop
-
开启服务自启动chkconfig redis on
以上是关于Linux下安装redis的主要内容,如果未能解决你的问题,请参考以下文章