首页 > 系统服务 > 详细

linux安装redis

时间:2019-11-18 22:01:47      阅读:99      评论:0      收藏:0      [点我收藏+]

down最新的redis

wget http://download.redis.io/releases/redis-5.0.6.tar.gz

tar zxf redis-5.0.6.tar.gz 

cd redis-5.0.6 && make

mkdir -p /usr/local/redis/bin

cp redis.conf /usr/local/redis/bin  /usr/local/bin

cp src/redis-cli  /usr/local/redis/bin  /usr/local/bin

cp src/redis-server  /usr/local/redis/bin  /usr/local/bin

cp src/redis-benchmark  /usr/local/redis/bin  /usr/local/bin

vim /usr/bin/redis

启动文件


#!/bin/sh
#
# as it does use of the /proc filesystem.


REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/local/redis/bin/redis.conf"
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is alread
y running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process i
s not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -a 123456 -p $REDISPORT shutdow
n
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown
..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument
"
;;
esac

chmod 777 /usr/bin/redis  #给上面文件的权限

配置文件

vim /usr/local/redis/bin/redis.conf

---------------------------------------------

# bind 127.0.0.1

protected-mode no

---------------------------------------------

窗口运行

 screen redis start

ctrl+A+D跳出窗口

kill pid可以停止服务

或者redis stop

或者screen -r 对应窗口终止服务

 

linux安装redis

原文:https://www.cnblogs.com/Leaders543/p/11884966.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!