安装编译工具
yum -y install gcc make wget
下载安装包
wget -c http://download.redis.io/releases/redis-5.0.7.tar.gz
解压
tar zxvf redis-5.0.7.tar.gz
cd redis-5.0.7
编译安装
make PREFIX=/usr/local/redis install
创建配置文件
mkdir -p /data/redis
cat > /usr/local/redis/6379.conf <<EOF
bind 0.0.0.0
protected-mode yes
port 6379
requirepass opcai
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
pidfile /data/redis/redis_6379.pid
loglevel notice
logfile "/data/redis/redis_6379.log"
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
dbfilename dump_6379.rdb
dir /data/redis/
appendonly yes
appendfilename "appendonly_6379.aof"
appendfsync everysec
slowlog-log-slower-than 10000
slowlog-max-len 128
EOF
启动
/usr/local/redis/bin/redis-server /usr/local/redis/6379.conf