下载redis

官网
https://redis.io/download
# 下载
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
# Installation
tar xzf redis-5.0.3.tar.gz
cd redis-5.0.3
make
# 创建文件夹 
mkdir /usr/local/redis/conf
mkdir /usr/local/redis/data
mkdir /usr/local/redis/logs
# run
src/redis-server

# warning 1 > 提示修改 linux内核参数
# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
echo 1024 >/proc/sys/net/core/somaxconn

# warn 2 > 提示如下
# WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
sysctl vm.overcommit_memory=1

# warning 3
# WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled
echo never > /sys/kernel/mm/transparent_hugepage/enabled


# 云服务器要注意ip要写对,端口要开放
# 虚拟机要注意防火墙要关闭 systemctl stop firewalld.service