软件环境
Ubuntu 14.04.2 LTS
redis-2.8.24.tar.gz
单机版安装
下载源码:
wget http://download.redis.io/releases/redis-2.8.24.tar.gz
解压:
tar xzf redis-2.8.24.tar.gz
编译安装:
make
make install```
# 单机版配置
## 配置启动脚本
```cp utils/redis_init_script /etc/init.d/redis_6379
vi /etc/init.d/redis_6379```
主要配置下面的参数:
```REDISPORT=6379
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf"```
## 建立需要的目录
```mkdir -p /etc/redis/ /var/redis/6379/ /var/log/redis/ /var/lib/redis```
## 修改配置文件
```cp redis.conf /etc/redis/6379.conf
vi /etc/redis/6379.conf```
主要修改如下配置:
```daemonize yes
pidfile /var/run/redis_6379.pid
timeout 300
loglevel notice
logfile /var/log/redis/redis_6379.log
dir /var/lib/redis```
# 启动、停止redis
```/etc/init.d/redis_6379 start
redis-cli shutdown```
# 开机自动启动
```update-rc.d redis_6379 defaults```
网友评论