1 下载redis包,编译安装
wget http://download.redis.io/redis-stable.tar.gz
tar xf redis-stable.tar.gz && cd redis-stable
make (若有报错安装对应的依赖包;然后先执行make distclean(清理缓存)再执行make)
make install
2 创建配置目录
mkdir -pv /var/redis/{data,run,log}
mkdir /etc/redis/
3 复制相应文件到对应目录
cp /root/redis-stable/redis.conf /etc/redis/redis.conf
cp /redis-stable/utils/redis_init_script /etc/init.d/redis
4 修改配置文件redis.conf
pidfile /var/redis/run/redis_6379.pid
dir /var/redis/data (备份目录)
logfile /var/redis/redis/redis.log
5 修改启动脚本部分内容/etc/init.d/redis
REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/redis/run/redis_${REDISPORT}.pid
CONF="/etc/redis/redis_${REDISPORT}.conf"
6 启动
service redis_6379 start
原文地址:http://blog.51cto.com/fuvip/2113879
时间: 2024-11-04 13:02:52