目前Redis最新的稳定版本为3.0.5,那么就以次版本为例,以下是安装步骤:
一.安装Redis
1.下载Redis3.0软件包并解压
[root@vm1 ~]# cd /appbase/apps
[root@vm1 ~]# rz
[root@vm1 ~]# tar xzvf redis-3.0.5.tar.gz
2.创建个人用户
[root@vm1 ~]# useradd -u 611 -g dbg -d /appbase/users/rdsusr01 rdsusr01
[root@vm1 ~]# echo oracle|passwd --stdin rdsusr01
3.编译安装Redis
[root@vm1 apps]# cd /appbase/apps/redis-3.0.5
[root@vm1 redis-3.0.5]# make
[root@vm1 redis-3.0.5]# make test
[root@vm1 redis-3.0.5]#make PREFIX=/appbase/users/rdsusr01/redis
[root@vm1 redis-3.0.5]# make PREFIX=/appbase/users/rdsusr01/redis install
--安装完成后会生产以下文件
[root@vm1 redis-3.0.5]# ls /appbase/users/rdsusr01/redis/bin
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server
--简单说明下每个文件的作用
redis-server:Redis服务器
redis-sentinel:Redis哨兵服务,主要用于监控和故障切换
redis-cli:与Redis服务交互的命令行接口
redis-benchmark:用于检测Redis性能
redis-check-aof:AOF文件检查工具
redis-check-dump:RDB文件检查工具
4.配置Redis
[root@vm1 redis-3.0.5]# chown -R rdsusr01:dbg /appbase/users/rdsusr01
[root@vm1 redis-3.0.5]# su - rdsusr01
[rdsusr01@vm1 ~]$ vi .bash_profile
export REDIS_HOME=/appbase/users/rdsusr01/redis
export PATH=$REDIS_HOME/bin:$PATH
[rdsusr01@vm1 ~]$ source .bash_profile
[rdsusr01@vm1 ~]$ mkdir redis/{logs,conf,data}
[rdsusr01@vm1 ~]$ cp /appbase/apps/redis-3.0.5/redis.conf redis/conf/
[rdsusr01@vm1 ~]$ vi redis/conf/redis.conf
daemonize yes
pidfile /appbase/users/rdsusr01/redis/data/redis-single.pid
port 16379
tcp-backlog 511
bind 192.168.157.128
timeout 180
tcp-keepalive 60
loglevel notice
logfile /appbase/users/rdsusr01/redis/logs/redis-single.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename redis-signle
dir /appbase/users/rdsusr01/redis/data/
appendonly no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
注:标红的参数为修改的内容,其余的参数都是继承的默认值。
4.启动Redis
[rdsusr01@vm1 ~]$ redis-server /appbase/users/rdsusr01/redis/conf/redis.conf
5.验证Redis服务是否正常
[rdsusr01@vm1 ~]$ redis-cli -h 192.168.157.128 -p 16379
192.168.157.128:16379> ping
PONG
192.168.157.128:16379> set person leige
OK
192.168.157.128:16379> get person
"leige"
至此,Redis安装成功
一.安装Redis
1.下载Redis3.0软件包并解压
[root@vm1 ~]# cd /appbase/apps
[root@vm1 ~]# rz
[root@vm1 ~]# tar xzvf redis-3.0.5.tar.gz
2.创建个人用户
[root@vm1 ~]# useradd -u 611 -g dbg -d /appbase/users/rdsusr01 rdsusr01
[root@vm1 ~]# echo oracle|passwd --stdin rdsusr01
3.编译安装Redis
[root@vm1 apps]# cd /appbase/apps/redis-3.0.5
[root@vm1 redis-3.0.5]# make
[root@vm1 redis-3.0.5]# make test
[root@vm1 redis-3.0.5]#make PREFIX=/appbase/users/rdsusr01/redis
[root@vm1 redis-3.0.5]# make PREFIX=/appbase/users/rdsusr01/redis install
--安装完成后会生产以下文件
[root@vm1 redis-3.0.5]# ls /appbase/users/rdsusr01/redis/bin
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server
--简单说明下每个文件的作用
redis-server:Redis服务器
redis-sentinel:Redis哨兵服务,主要用于监控和故障切换
redis-cli:与Redis服务交互的命令行接口
redis-benchmark:用于检测Redis性能
redis-check-aof:AOF文件检查工具
redis-check-dump:RDB文件检查工具
4.配置Redis
[root@vm1 redis-3.0.5]# chown -R rdsusr01:dbg /appbase/users/rdsusr01
[root@vm1 redis-3.0.5]# su - rdsusr01
[rdsusr01@vm1 ~]$ vi .bash_profile
export REDIS_HOME=/appbase/users/rdsusr01/redis
export PATH=$REDIS_HOME/bin:$PATH
[rdsusr01@vm1 ~]$ source .bash_profile
[rdsusr01@vm1 ~]$ mkdir redis/{logs,conf,data}
[rdsusr01@vm1 ~]$ cp /appbase/apps/redis-3.0.5/redis.conf redis/conf/
[rdsusr01@vm1 ~]$ vi redis/conf/redis.conf
daemonize yes
pidfile /appbase/users/rdsusr01/redis/data/redis-single.pid
port 16379
tcp-backlog 511
bind 192.168.157.128
timeout 180
tcp-keepalive 60
loglevel notice
logfile /appbase/users/rdsusr01/redis/logs/redis-single.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename redis-signle
dir /appbase/users/rdsusr01/redis/data/
appendonly no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
注:标红的参数为修改的内容,其余的参数都是继承的默认值。
4.启动Redis
[rdsusr01@vm1 ~]$ redis-server /appbase/users/rdsusr01/redis/conf/redis.conf
5.验证Redis服务是否正常
[rdsusr01@vm1 ~]$ redis-cli -h 192.168.157.128 -p 16379
192.168.157.128:16379> ping
PONG
192.168.157.128:16379> set person leige
OK
192.168.157.128:16379> get person
"leige"
至此,Redis安装成功
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/20801486/viewspace-1871982/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/20801486/viewspace-1871982/