Redis Cluster Technology
- redis2.x using client-side sharding technology
- redis3.x Using cluster clustering technology
First, the environment
- Os:centos7
- ip:10.211.55.4
- redis:3.2.5
- gem-redis:3.2.2
Second, build a cluster
1, this machine download redis-3.2.5.tar.gz
- Redis Official website: https://redis.io/download
2. Copy from native to 10.211.55.4
- SCP redis-3.2.5.tar.gz [Email protected]:/opt/
3, enter the 10.211.55.4, unzip the installation
- Tar-zxf/opt/redis-3.2.5.tar.gz
- cd/opt/ redis-3.2.5/
- Make && make install
4. Create a folder
- Mkdir/data/cluster-p
- cd/data/cluster/
- mkdir 7000 7001 7002 7003 7004 7005
5. Copy Modify configuration file
- Cp/opt/redis-3.2.5/redis.conf/data/cluster/7000/
- Vi/data/cluster/7000/redis.conf
- Bind 10.211.55.4
- Port 7004
- Daemonize Yes
- cluster-enabled Yes
- Cluster-config-file nodes.conf
- Cluster-node-timeout 15000
- Copy the redis.conf to 7001~7005, and modify the port number
6. Start 6 Redis instances
- cd/data/cluster/7000
- Redis-server redis.conf
Other similar.
7. Install Ruby dependencies
- Yum install ruby Rubygems-y
8, the local download installation Gem-redis
- Download: https://rubygems.org/gems/redis/versions/3.2.2
- Copy the Gem-redis to the 10.211.55.4
- sCP redis-3.2.2.gem [email protected]:/opt/
- Installation: Gem install-l/opt/redis-3.2.2.gem
9. Copy the cluster management program to/usr/local/bin/
- Cp/opt/redis-3.2.5/src/redis-trib.rb/usr/local/bin/redis-trib
10. Create a cluster
- Redis-trib Create --replicas 1 10.211.55.4:7000 10.211.55.4:7001 10.211.55.4:7002 10.211.55.4:7003 10.211.55.4:7004 10.211.55.4:7005
- --replicas 1: Create a Slave node for each master node in the cluster
- The cluster requires at least 3 primary nodes for normal operation: The above is three main three from
11. Testing
Use RDM for connectivity testing.
Second, Java operation (Jediscluster)
Chapter III Springboot + Jediscluster
12th Redis-cluster Construction (redis-3.2.5)