1. 安装redis服务
去这里找最新版:
http:
//download
.redis.io
编译:
wget http:
//download
.redis.io
/releases/redis-4
.0.2.
tar
.gz
tar
zxvf redis-4.0.2.
tar
.gz
cd
redis-4.0.2
make
安装编译后的程序:
make
install
当然,可以指定位置安装的,例如:
make
PREFIX=
/opt/redis4
install
此时:
# ls /opt/redis4/bin/
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server
注意对引导按照server的影响:
# sh utils/install_server.sh
Welcome to the redis service installer
This script will help you easily
set
up a running redis server
Please
select
the redis port
for
this instance: [6379]
Selecting default: 6379
Please
select
the redis config
file
name [
/etc/redis/6379
.conf]
Selected default -
/etc/redis/6379
.conf
Please
select
the redis log
file
name [
/var/log/redis_6379
.log]
Selected default -
/var/log/redis_6379
.log
Please
select
the data directory
for
this instance [
/var/lib/redis/6379
]
Please
select
the redis executable path []
Mmmmm... it seems like you don't have a redis executable. Did you run
make
install
yet?
####这里要指定 redis-server 的路径,这一条提示是没指定直接回车时的结果,下一条是正确的姿势
Please
select
the redis executable path []
/opt/redis4/bin/redis-server
Selected config:
Port : 6379
Config
file
:
/etc/redis/6379
.conf
Log
file
:
/var/log/redis_6379
.log
Data
dir
:
/var/lib/redis/6379
Executable :
/opt/redis4/bin/redis-server
Cli Executable :
/opt/redis4/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied
/tmp/6379
.conf =>
/etc/init
.d
/redis_6379
####这里有一个开机启动项的配置
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
启动的时候 连同6379.config文件一起启动 ,这样AOF配置才会生效
[root@winner etc]# cd /usr/local/bin
[root@winner bin]# ./redis-server /etc/6379.conf