Redis群集的搭建
实验环境
用两台服务器模拟6台服务器(添加网卡)
主服务器M1 192.168.13.128
主服务器M2 192.168.13.135
主服务器M3 192.168.13.136
从服务器S1 192.168.13.129
从服务器S2 192.168.13.137
从服务器S3 192.168.13.138
软件版本:redis-5.0.7
1、在两台服务器上都安装Redis
[root@localhost ~]# yum install gcc gcc-c++ make -y ##安装环境组件
[root@localhost ~]# mount.cifs //192.168.100.3/LNMP-C7 /mnt/ ##挂载
Password for root@//192.168.100.3/LNMP-C7:
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# tar zxvf redis-5.0.7.tar.gz -C /opt/ ##解压
[root@localhost mnt]# cd /opt/redis-5.0.7/
[root@localhost redis-5.0.7]# make ##编译
[root@localhost redis-5.0.7]# make PREFIX=/usr/local/redis/ install ##安装
[root@localhost redis-5.0.7]# cd utils/
[root@localhost utils]# ./install_server.sh ##执行脚本进行配置
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this instance: [6379] ##默认端口
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] #配置文件
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] #日志文件
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/