redis Sentinel Cluster Setup

Download redis jar package redis-4.0.11.tar.gz on / data / redis catalog

Unzip command: tar -zxvf redis-4.0.11.tar.gz

 

 After extracting shown in FIG.

 

 Redis_sentinel create a folder in / usr / local directory

 

 The redis unpack the files / data / redis folder to the directory / usr / local / redis_sentinel directory command mv /data/redis/redis-4.0.11 / usr / local / redis_sentinel /

 6379 6380 6381 sentinel_server create four folders in the / usr / local / redis_sentinel directory, the command mkdir 6379 6380 6381 sentinel_server

 

 Into redis-4.0.11 directory, the command make all

 

 The redis-4.0.11 / redis.conf files are copied to directory 637963806381, the redis-4.0.11 / sentinel.conf files are copied to directory sentinel_server shown below

 

 We will serve as the primary 6379, under the 6379 document editing redis.conf

daemonize set to yes

protected-mode setting is set to no, if not no, web services are not connected to the

 

 Commented bind ip address, or to 0.0.0.0 or remote connection is not accessible

 

 redis.conf edit files in 6380

daemonize set to yes; protected-mode set to no; commented bind ip address (the three steps above);

In addition to modifying port 6380

Sets the current node is the master node slaveof 127.0.0.1 6379

 

 redis.conf edit files in 6381

daemonize set to yes; protected-mode set to no; commented bind ip address (the three steps above);

In addition to modifying port 6381

Sets the current node is the master node slaveof 127.0.0.1 6379sentinel monitor mymaster 127.0.0.1 6379 1

sentinel.conf file in the editor sentinel_server

Set sentinel monitor mymaster 127.0.0.1 6379 1 (mymaster free to take, but the following needs to be consistent with here; if you want to use in the web application, 127.0.0.1 must be changed to correspond to the ip address, otherwise Rom)

 

 Set sentinel down-after-milliseconds mymaster 10000 can also change the default

 Add daemonize yes

 

Here default unchanged

 

 

Set failover-timeout mymaster 60000

 

 

 637963806381 three start nodes and services, as shown in FIG.

 

 Start sentinel Service

 

 6379 into the node, the primary node display; aaa set to 111, and can succeed

 

 Enter 6380 node appears as slave node can successfully get the value aaa, but can not add value, which is redis separate read and write

 

Enter 6381 node, like node 6380

 

 

 Now we try to shutdown node 6379

 

 We enter 6380 node, find the master node has become 6381

 

 6381 into the node, as shown in FIG.

 

 We found 6381 node becomes the master node does, and you can set the new value; this is redis Sentinel cluster, when the primary node is down, will be the new primary node from a selected node as

Guess you like

Origin www.cnblogs.com/hjw-zq/p/11923102.html