- 集群环境
- 集群机器信息
主机名 | IP | 服务端口 | 配置文件 | 主从 |
SHQZ-PS-IOV-SV-Redis04 | 172.17.125.239 | 6034 | /etc/6034.conf | master |
SHQZ-PS-IOV-SV-Redis05 | 172.17.125.240 | 6035 | /etc/6035.conf | master |
SHQZ-PS-IOV-SV-Redis06 | 172.17.125.241 | 6036 | /etc/6036.conf | master |
SHQZ-PS-IOV-SV-Redis01 | 172.17.125.236 | 6030 | /etc/6030.conf | slave |
SHQZ-PS-IOV-SV-Redis02 | 172.17.125.237 | 6031 | /etc/6031.conf | slave |
SHQZ-PS-IOV-SV-Redis03 | 172.17.125.238 | 6033 | /etc/6033.conf | slave |
-
- 集群配置参数
配置参数 | 配置的值 | 说明 |
maxmemory | 24000000000 | 最大内存占用 |
cluster-enabled | yes | 打开reids集群 |
daemonize | yes | 是否作为守护进程运行 |
appendonly | yes | 启用aof持久化方式 |
port | 6030 | 端口 |
database | 1 | 可用数据库数 |
bind | ip | 绑定的IP |
masterauth | !PassW0rd | 主从同步的密码 |
requirepass | !PassW0rd | redis密码 |
- 网络配置
- 关闭防火墙
Servic iptble stop
- 软件包安装
- 安装redis
上传安装包redis-3.2.4.tar.gz
解压安装包
Tar -zxvf redis-3.2.4.tar.gz
打开目录
cd redis-3.2.4
编译安装
make && make install
2、编辑配置文件
172.17.125.239 | copy /etc/redis.conf /etc/6034.conf |
172.17.125.240 | copy /etc/redis.conf /etc/6035.conf |
172.17.125.241 | copy /etc/redis.conf /etc/6036.conf |
172.17.125.236 | copy /etc/redis.conf /etc/6030.conf |
172.17.125.237 | copy /etc/redis.conf /etc/6031.conf |
172.17.125.238 | copy /etc/redis.conf /etc/6033.conf |
根据1.2的集群配置参数信息去配置conf内容
3、ruby的安装(yum方式)
yum install ruby rubygems
4、ruby安装redis模块
rubygems install redis-3.3.0.gem
5、安装完成检查版本
ruby -v
启动方式:
172.17.125.239 | redis-server /etc/6034.conf |
172.17.125.240 | redis-server /etc/6035.conf |
172.17.125.241 | redis-server /etc/6036.conf |
172.17.125.236 | redis-server /etc/6030.conf |
172.17.125.237 | redis-server /etc/6031.conf |
172.17.125.238 | redis-server /etc/6033.conf |
- 创建集群
进入目录/ericsson/iov/redis/redis-3.2.4/src,执行命令
redis-trib create --replicas 1 172.17.125.237:6031 172.17.125.236:6030 172.17.125.238:6033 172.17.125.241:6036 172.17.125.239:6034 172.17.125.240:6035
查看集群状态
Redis-cli -c -h 172.17.125.237 -p 6031 -a ‘!PassW0rd’ cluster nodes