Redis cluster (cluster mode) structures (three from three master)

Previous built from a main two, and joined the Sentinel, hang up any node will not affect the normal use, to achieve high availability. There is still a problem, a main two from each node stores all the data, with the huge business data volume exceeds the capacity of the nodes, even redis can configure the clean-up, but there are limits, so the need to build redis clusters, data They are stored in the different redis, and can be extended laterally.

This build three main sections from three, i.e. three groups of a master-slave. The group is a master-slave relationship, high availability can be achieved; the relationship between the groups is the cluster, to achieve the division of storage.

Started building (2,3 step redis all nodes have to do)

  1, to prepare six redis, are configured on masterauth <master-password> (unclear can refer to my other blog post "Redis master-slave, Sentinel")

  2, modify the core configuration vim /usr/local/redis/redis.conf

# Enable the cluster mode
cluster-enabled yes
# Each node needs to have a configuration file, you need six. Each node in the cluster roles need to inform all other nodes know each other, this file is used to cluster state and other information in the storage cluster mode, this file is maintained by redis ourselves, we do not control. If you want to create a new cluster, then deleted this file on the line
cluster-config-file nodes-201.conf
# Timeout period expires, the master that down, then the switchover
cluster-node-timeout 5000
# Enable AOF
appendonly yes

  3, delete the workspace and aof file rdb

  4, respectively, starting six redis

  5, create a cluster, execute the following command on any node, there will be executing the log, six master-slave relationship will be displayed.

#####
Note # 1: If you are using redis3.x version, need to use Redis - trib.rb to build a cluster, the latest version of the C language to build, and to pay attention to this
Note # 2: The following construction of the new version of redis way
#####

# Create a cluster, the master node and the slave node ratio is 1, the correspondence between master and slave is automatically assigned. 
Redis the -cli --cluster Create IP1: IP2 portl: port2, IP3: Port3 IP4: Port4 IP5: IP6, port5: port6 --cluster-Replicas . 1

   6. Check

redis-cli -a imooc --cluster check 192.168.25.64:6380

   7, self-test one or several hang up if still available.  

  Thus, to ensure the high availability, but also expand the capacity.

 

 

                                          Since finishing Mu class network "java architect architecture class"

Guess you like

Origin www.cnblogs.com/hmxs/p/12101921.html