1. 下载redis
https://redis.io/download
$ wget http://download.redis.io/releases/redis-3.2.8.tar.gz
$ tar xzf redis-3.2.8.tar.gz
$ cd redis-3.2.8
$ make
cd src/
make install
2. 运行redis
$ cd redis-3.2.8
服务端启动
$ src/redis-server redis.conf
客户端连接
$ src/redis-cli -h m01 -p 6379
服务端停止
$ src/redis-cli -h m01 -p 6379 shutdown
或者为了方便可以单独把redis的服务端客户端脚本及配置文件redis.conf单独copy到一个文件目录内。
3.关键配置
bind m01
port 6379
daemonize yes //默认后台启动
dbfilename xxx.rdb //使用rdb方式持久化数据
dir /xx/xx/xx //存放rdb或者aof文件的路径
appendonly no //是否开启aof
appendfilename "xxx.aof" //aof文件名字
4.redis启动的时候会从xx.rdb中加载历史数据