Redis复制和哨兵部署

环境准备

主机名sht-sgmhadoopdn-01sht-sgmhadoopdn-02sht-sgmhadoopdn-03
OSCentOS Linux release 7.6.1810 (Core)
IP地址172.16.101.58172.16.101.58172.16.101.58
redis安装路径/usr/local/redis
角色masterslaveslave

redis各版本下载地址

http://download.redis.io/releases/

此处我们选择3.2.12版本

http://download.redis.io/releases/redis-3.2.12.tar.gz

系统环境配置

新建系统用户redis

# groupadd -r dba
# useradd -r -g dba -G root redis

内核参数优化

# cat /etc/sysctl.conf
.......................
vm.overcommit_memory=1
vm.swappiness=1
fs.aio-max-nr=1048576
fs.file-max= 7672460
net.ipv4.ip_local_port_range=9000 65500
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048586
net.core.somaxconn = 2048
kernel.sem= 50100 64128000 50100 1280
kernel.shmall=5242880
kernel.shmmax=12884901888
.......................

系统资源使用优化

# echo "redis               soft    nproc           65536" >> /etc/security/limits.conf
# echo "redis               hard    nproc           65536" >> /etc/security/limits.conf
# echo "redis               soft    nofile          65536" >> /etc/security/limits.conf
# echo "redis               hard    nofile          65536" >> /etc/security/limits.conf

大内存页优化

# echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local

相关推荐