I. Planning Chapter
1. Machine Planning
Matser Slave
192.168.1.31:7000 192.168.1.31:7001
192.168.1.32:7000 192.168.1.32:7001
192.168.1.33:7000 192.168.1.33:7001
192.168.1.34:7000 192.168.1.34:7001
2. Program Planning
configuration file:
Matser: /usr/local/etc/redis-cluster/redis-7000
Slave: /usr/local/etc/redis-cluster/redis-7001
Execute the program:
/usr/local/bin
Source Path:
/opt/redis-3.0.7
Two. Installation Chapter
1. Compiling Redis
#将redis解压到/opt tar zxvf redis-3.0.7.tar.gz-c/opt# into the Redis directory and compile cd/opt/redis-3.0.7 && make malloc=libc# Installing Redismake Install
2. Create a master & slave profile
Create a configuration file #创建目录mkdir/usr/local/etc/redis-cluster/redis-7000/usr/local/etc/redis-cluster/redis-7001# cp/opt/ redis-3.0.7/redis.conf mkdir/usr/local/etc/redis-cluster/redis-7000/#修改配置文件vim/opt/redis-3.0.7/redis.conf mkdir/ usr/local/etc/redis-cluster/redis-7000/redis.conf Modify the following configuration: Port 7000daemonize yescluster-enabled Yescluster-config-file nodes.confcluster-node-timeout 5000appendonly Yes from the node and other machines are modified sequentially, but the port number needs to be changed according to the actual;
3. Start Redis
#每个节点都需要启动/usr/local/bin/redis-server/opt/redis/cluster/redis-7000.conf #检查redis状态ps-aux|grep Redis
4. Configuring the GEM Environment
#安装gem需要1.8.7 version above, if not need to upgrade, here does not show upgrade; Yum install ruby ruby-devel rubygems rpm-build# Install the Redis Ruby interface gem install redis# Build cluster configuration redis-trib.rb Create--replicas 1 192.168.1.31:7000 192.168.1.32:7001 192.168.1.32:7000 192.168.1.33:7001 192.168.1.33:7000 192.168.1.34:7001 192.168.1.34:7000 192.168.1.31:7001#redis-trib.rb Create cluster # 11 master nodes corresponding SLA VE node number
5. Log in to a Redis cluster node
Redis-cli-c-P 7000
6. Check the cluster
REDIS-TRIB.RB Check 192.168.1.31:7000# If there are no warnings or errors, the cluster starts successfully and is aware of the OK status
This article is from "Luo old Three's Yun-Dimensional Road" blog, reprint please contact the author!
002. Redis Cluster Deployment