Answer the question
In order to leave comments, you need to log in
How to set up redis and sentinel?
We have 4 servers:
- 10.0.3.91
- 10.0.3.92
- 10.0.3.93
- 10.0.3.94
Each has redis installed with config
bind {{ ansible_default_ipv4.address }} 127.0.0.1
port 6379
dir /var/lib/redis
logfile /var/log/redis/redis.log
loglevel debug
# далее для мастера
requirepass mypass
#далее для slave
slaveof 10.0.3.91 6379
masterauth mypass
port 26379
dir /tmp
logfile "/var/log/redis/sentinel.log"
sentinel monitor mymaster 10.0.3.91 6379 2
sentinel down-after-milliseconds mymaster 10000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1
sentinel auth-pass mymaster mypass
3169:M 09 Aug 19:19:04.261 * Background saving terminated with success
3169:M 09 Aug 19:19:04.261 * Synchronization with slave 10.0.3.92:6379 succeeded
3169:M 09 Aug 19:19:04.261 * Synchronization with slave 10.0.3.94:6379 succeeded
3169:M 09 Aug 19:19:04.261 * Synchronization with slave 10.0.3.93:6379 succeeded
3213:X 09 Aug 19:19:04.457 # Sentinel ID is c627d18a4ae8692b7bbca50d5f74b1735c155030
3213:X 09 Aug 19:19:04.457 # +monitor master mymaster 10.0.3.91 6379 quorum 2
3213:X 09 Aug 19:19:04.457 * +slave slave 10.0.3.92:6379 10.0.3.92 6379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:04.522 * +slave slave 10.0.3.94:6379 10.0.3.94 6379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:04.589 * +slave slave 10.0.3.93:6379 10.0.3.93 6379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:06.422 * +sentinel sentinel 4b379a69e8ec306676297185e79e5814381cfbe4 10.0.3.92 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:06.470 * +sentinel sentinel 53587213efa28e0f89994f5d53fd988ad5ba4e67 10.0.3.94 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:06.621 * +sentinel sentinel 99b62184268404737e73c263dbd935078bc0a936 10.0.3.93 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:16.448 # +sdown sentinel 4b379a69e8ec306676297185e79e5814381cfbe4 10.0.3.92 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:16.506 # +sdown sentinel 53587213efa28e0f89994f5d53fd988ad5ba4e67 10.0.3.94 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:16.670 # +sdown sentinel 99b62184268404737e73c263dbd935078bc0a936 10.0.3.93 26379 @ mymaster 10.0.3.91 6379
service redis stop
3213:X 09 Aug 19:19:04.457 # Sentinel ID is c627d18a4ae8692b7bbca50d5f74b1735c155030
3213:X 09 Aug 19:19:04.457 # +monitor master mymaster 10.0.3.91 6379 quorum 2
3213:X 09 Aug 19:19:04.457 * +slave slave 10.0.3.92:6379 10.0.3.92 6379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:04.522 * +slave slave 10.0.3.94:6379 10.0.3.94 6379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:04.589 * +slave slave 10.0.3.93:6379 10.0.3.93 6379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:06.422 * +sentinel sentinel 4b379a69e8ec306676297185e79e5814381cfbe4 10.0.3.92 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:06.470 * +sentinel sentinel 53587213efa28e0f89994f5d53fd988ad5ba4e67 10.0.3.94 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:06.621 * +sentinel sentinel 99b62184268404737e73c263dbd935078bc0a936 10.0.3.93 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:16.448 # +sdown sentinel 4b379a69e8ec306676297185e79e5814381cfbe4 10.0.3.92 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:16.506 # +sdown sentinel 53587213efa28e0f89994f5d53fd988ad5ba4e67 10.0.3.94 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:19:16.670 # +sdown sentinel 99b62184268404737e73c263dbd935078bc0a936 10.0.3.93 26379 @ mymaster 10.0.3.91 6379
3213:X 09 Aug 19:21:30.090 # +sdown master mymaster 10.0.3.91 6379
Answer the question
In order to leave comments, you need to log in
the question is removed, in order to see the result of the work of sentinel, you need to add it to the data radish
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question