Configure the environment:
two virtual machines
Turn off the firewall and SElinux
systemctl stop firewalld
setenforce 0
Two virtual machines must be connected to the same network
must be in the same network segment as
the same network segment
In the top two virtual machines, download the configuration Redis
cd /usr/local/src
wget http://download.redis.io/releases/redis-3.2.4.tar.gz
tar -zxvf redis-3.2.4.tar.gz
Then enter redis-3.2.4 directory, compile and install:
make && make install
Redis host configuration file
vim redis.conf
bind + 主机IP
logfile #(前面加注释)
Redis from machine configuration file
vim redis.conf
logfile #(前面加注释)
Host configuration file Sentinel:
daemonize yes
slaveof 192.168.124.48 6379
slaveof 192.168.124.104 6379
Add two hosts IP plus port
Slave configuration file Sentinel:
vim sentinel.conf
daemonize yes
slaveof 192.168.124.48 6379
Start and Redis Sentinel:
redis-server /usr/local/src/redis-3.2.4/redis.conf
redis-sentinel /usr/local/src/redis-3.2.4/sentinel.conf
After a successful start, refresh the host, it will display the slave IP.
As follows
net -tuplan | grep redis