一、yum安装
1.安装
# sudo yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# sudo yum --enablerepo=remi install redis -y
2.设置集群
# (1)修改配置文件,将以下两行的注释去掉
cluster-enabled yes
cluster-config-file nodes-6379.conf
# (2)启动redis
# sudo systemctl restart redis
# redis-cli -h 127.0.0.1 -p 6379 cluster addslots {0..16383}
3.redis 压测
# redis-benchmark -h xxx -p 6379 -c 1 -n 10000 -t get -q
相关参数: https://www.runoob.com/redis/redis-benchmarks.html
二、编译安装
1.下载
# yum install -y gcc make
# cd /cust/utils
# wget http://download.redis.io/releases/redis-5.0.8.tar.gz
# tar zxvf redis-5.0.8.tar.gz
# cd /cust/utils/redis-5.0.8
# make
# make PREFIX=/usr/local/redis install
#### 注意 在make 时可能会出错 zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h########
# 解决方法
# cd deps
# make jemalloc hiredis linenoise lua
2.修改配置
# mkdir /usr/local/redis/conf/
# cp /cust/utils/redis-5.0.8/redis.conf /usr/local/redis/conf/
# vim /usr/local/redis/conf/redis.conf # 修改下面配置
dir /cust/data/redis
logfile "/cust/logs/redis/redis.log"
# mkdir -p /cust/data/redis /cust/logs/redis/
3.启动
# /usr/local/redis/bin/redis-server /usr/local/redis/conf/redis.conf &