Redis cluster mode of Windows Sentinel article

1. Environment

  a download Redis:. https://github.com/MicrosoftArchive/redis/releases access to download the Windows version of Redis, and extract

 

 

2. Sentinel Mode Configuration

  a. Copy 3 parts Redis as nodes 3, named 8081,8082,8083

 

  b. Modify redis.windows.conf configuration file in each node Redis

    1) 8081 nodes:

# Port number was changed to 8081 
Port 8081

    2) The 8082 node:

# Port number was changed to 8082 
Port 8082 # Set the slave's master server 8081 
slaveof 127.0.0.1 8081

    3) 8083 nodes:

# Port number was changed to 8083 
Port 8083 # Set the slave's master server 8081 
slaveof 127.0.0.1 8081

 

  c. Create sentinel.conf Sentinel profile Redis each node

    1) 8081 nodes:

127.0.0.1 the bind
 # current port Sentinel service running 
Port 8091 # the IP address of a called mymaster to monitor main redis example, the primary instance of the host address 127.0.0.1, port number 6379, and determines that the primary instance failure to require the consent of at least two Sentinel process, as long as the agreed amount Sentinel of non-compliance, it will not perform automatic failover 
Sentinel Monitor mymaster 127.0.0.1 8081 2 # specifies the number of milliseconds required Sentinel think Redis instance has failed. Examples of this time is not exceeded when the PING returned, either directly returns an error, then this example Sentinel marked subjective offline. Only one instance Sentinel process marked subjective offline does not necessarily lead to automatic failover instance: only after a sufficient number of Sentinel will be marked as a subjective offline instance, the instance will not be marked as objective off the assembly line, which when automatic failover will be performed 
Sentinel down-the After-milliseconds mymaster 5000 # specified at the time of failover, up to the number of Redis instances in sync from the new primary instance, the figure at more examples from Redis case , the longer the time synchronization, time required to complete failover longer 
Sentinel Parallel-mymaster the syncs. 1 # if failover operation fails to complete within the time (MS), failover is considered a failure 
sentinel failover-timeout mymaster 15,000



    2) The 8082 node:

127.0.0.1 the bind
 # current port Sentinel service running 
Port 8092 # the IP address of a called mymaster to monitor main redis example, the primary instance of the host address 127.0.0.1, port number 6379, and determines that the primary instance failure to require the consent of at least two Sentinel process, as long as the agreed amount Sentinel of non-compliance, it will not perform automatic failover 
Sentinel Monitor mymaster 127.0.0.1 8081 2 # specifies the number of milliseconds required Sentinel think Redis instance has failed. Examples of this time is not exceeded when the PING returned, either directly returns an error, then this example Sentinel marked subjective offline. Only one instance Sentinel process marked subjective offline does not necessarily lead to automatic failover instance: only after a sufficient number of Sentinel will be marked as a subjective offline instance, the instance will not be marked as objective off the assembly line, which when automatic failover will be performed 
Sentinel down-the After-milliseconds mymaster 5000 # specified at the time of failover, up to the number of Redis instances in sync from the new primary instance, the figure at more examples from Redis case , the longer the time synchronization, time required to complete failover longer 
Sentinel Parallel-mymaster the syncs. 1 # if failover operation fails to complete within the time (MS), failover is considered a failure 
sentinel failover-timeout mymaster 15,000



    3) 8083 nodes:

127.0.0.1 the bind
 # current port Sentinel service running 
Port 8093 # the IP address of a called mymaster to monitor main redis example, the primary instance of the host address 127.0.0.1, port number 6379, and determines that the primary instance failure to require the consent of at least two Sentinel process, as long as the agreed amount Sentinel of non-compliance, it will not perform automatic failover 
Sentinel Monitor mymaster 127.0.0.1 8081 2 # specifies the number of milliseconds required Sentinel think Redis instance has failed. Examples of this time is not exceeded when the PING returned, either directly returns an error, then this example Sentinel marked subjective offline. Only one instance Sentinel process marked subjective offline does not necessarily lead to automatic failover instance: only after a sufficient number of Sentinel will be marked as a subjective offline instance, the instance will not be marked as objective off the assembly line, which when automatic failover will be performed 
Sentinel down-the After-milliseconds mymaster 5000 # specified at the time of failover, up to the number of Redis instances in sync from the new primary instance, the figure at more examples from Redis case , the longer the time synchronization, time required to complete failover longer 
Sentinel Parallel-mymaster the syncs. 1 # if failover operation fails to complete within the time (MS), failover is considered a failure 
sentinel failover-timeout mymaster 15,000



 

  d. create a startup script

    1) Create a 8081 node Redis startup script start8081.bat:

cd 8081
title redis-8081
redis-server.exe redis.windows.conf

    2) Create a 8082 node Redis startup script start8082.bat:

cd 8082
title redis-8082
redis-server.exe redis.windows.conf

    3) Create a 8083 node Redis startup script start8083.bat:

cd 8083
title redis-8083
redis-server.exe redis.windows.conf

    4) Create a 8081 sentinel nodes Sentinel startup script startsentinel8081.bat:

cd 8081
title sentinel-8081
redis-server.exe sentinel.conf --sentinel

    5) Create a 8082 sentinel nodes Sentinel startup script startsentinel8082.bat:

cd 8082
title sentinel-8082
redis-server.exe sentinel.conf --sentinel

    6) Create a 8083 sentinel nodes Sentinel startup script startsentinel8083.bat:

cd 8083
title sentinel-8083
redis-server.exe sentinel.conf --sentinel

 

 

3. Test

  a start Reids and Sentinel Sentinel:. a double-click start8081.bat, start8082.bat, start8083.bat, startsentinel8081.bat, startsentinel8082.bat, startsentinel8083.bat start the service

  b. 8081 closed node Redis service (open because there is no running in the background, you can close the window)

  View sentinel node c 8081 Sentinel Log window: After the 8081 node Redis service closed, master switch by the 8081 became 8083

 

Guess you like

Origin www.cnblogs.com/vettel0329/p/11847647.html