1 下载安装包
cd /usr/local/src
wget http://download.redis.io/releases/redis-5.0.2.tar.gz
2 解压
tar zxvf redis-5.0.2.tar.gz
3 安装依赖包
yum -y install gcc gcc-c++
4 编译安装
cd redis-5.0.2
make MALLOC=libc && make install
5 配置redis 一主两从
[root@localhost redis-5.0.2]# cp redis.conf /etc/redis_6379.conf
[root@localhost redis-5.0.2]# cp redis.conf /etc/redis_6380.conf
[root@localhost redis-5.0.2]# cp redis.conf /etc/redis_6381.conf
主配置修改:redis_6379.conf
bind 0.0.0.0
replicaof 192.168.208.146
daemonize yes 后台守护
port 6379
从配置修改
=redis_6380.conf==
bind 0.0.0.0
daemonize yes 后台守护
port 6380
replicaof 192.168.208.146
replicaof 192.168.10.131 6379
replica-priority 100 优先级
redis_6381.conf
bind 0.0.0.0
daemonize yes 后台守护
port 6381
replicaof 192.168.208.146
replicaof 192.168.10.131 6379
replica-priority 90 优先级
6 运行服务
[root@localhost ~]# redis-server /etc/redis_6379.conf
28308:C 18 Nov 2019 01:54:16.096 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28308:C 18 Nov 2019 01:54:16.096 # Redis versio