1 下载redis5.0
wget http://download.redis.io/releases/redis-5.0.2.tar.gz
2、安装redis编译需要的环境
yum -y install gcc gcc-c++
3、编译安装redis
tar zxf redis-5.0.2.tar.gz
cd redis-5.0.2/
make MALLOC=libc && make install
4、复制三个redis.conf配置作一主两从
cp redis.conf /etc/6379.conf
cp redis.conf /etc/6380.conf
cp redis.conf /etc/6381.conf
5、修改一主两从三个配置配置bind 0.0.0.0 接收所有ip访问
vim /etc/6379.conf
修改主
修改从6380.conf
vim /etc/6380.conf
修改从6381.conf
vim /etc/6381.conf
6、修改配置三个哨兵
vim /tmp/sentinel1.conf
vim /tmp/sentinel2.conf
vim /tmp/sentinel3.conf
7.启动redis和哨兵
redis-server /etc/6379.conf
redis-server /etc/6380.conf
redis-server /etc/6381.conf
mkdir /var/log/redis
redis-sentinel /tmp/sentinel1.conf
redis-sentinel /tmp/sentinel2.conf
redis-sentinel /tmp/sentinel3.conf
8、测试是否成功
主 192.168.11.135:6379 redis从2个 哨兵3个
杀死redis主测试
redis主跳转成功