This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tail -50f /var/log/redis/redis-sentinel.log | |
2740:X 19 Feb 15:53:31.190 # +sdown master redis-cluster 192.168.1.11 6379 | |
2740:X 19 Feb 15:53:31.261 # +odown master redis-cluster 192.168.1.11 6379 #quorum 2/2 | |
2740:X 19 Feb 15:53:31.261 # +new-epoch 2 | |
2740:X 19 Feb 15:53:31.261 # +try-failover master redis-cluster 192.168.1.11 6379 | |
2740:X 19 Feb 15:53:31.270 # +vote-for-leader 7ec82e214b253e5b3762a2b003cb1a0c0b65adca 2 | |
2740:X 19 Feb 15:53:31.275 # b31dda0048d0daeb5f33ebc683102ba8fd1a7368 voted for 7ec82e214b253e5b3762a2b003cb1a0c0b65adca 2 | |
2740:X 19 Feb 15:53:31.275 # de37d92a0a179e5df009c6eadab99663b01f2c7c voted for 7ec82e214b253e5b3762a2b003cb1a0c0b65adca 2 | |
2740:X 19 Feb 15:53:31.355 # +elected-leader master redis-cluster 192.168.1.11 6379 | |
2740:X 19 Feb 15:53:31.355 # +failover-state-select-slave master redis-cluster 192.168.1.11 6379 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# systemctl stop redis-server.service | |
# | |
# | |
# systemctl start redis-server.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# redis-cli -h 192.168.1.11 -p 16379 | |
192.168.1.11:16379> sentinel master redis-cluster | |
1) "name" | |
2) "redis-cluster" | |
3) "ip" | |
4) "192.168.1.11" | |
5) "port" | |
6) "6379" | |
7) "runid" | |
8) "a9a7b96ffd2d7ca6e137a1094e2e49c9b0947ed4" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# redis-cli | |
127.0.0.1:6379> auth password | |
OK | |
127.0.0.1:6379> info replication | |
# Replication | |
role:slave | |
master_host:192.168.1.11 | |
master_port:6379 | |
master_link_status:up | |
master_last_io_seconds_ago:1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# redis-cli | |
127.0.0.1:6379> auth password | |
OK | |
127.0.0.1:6379> info replication | |
# Replication | |
role:master | |
connected_slaves:2 | |
slave0:ip=192.168.1.12,port=6379,state=online,offset=55795025,lag=0 | |
slave1:ip=192.168.1.13,port=6379,state=online,offset=55795025,lag=0 | |
master_replid:58342127af8c471b0308d221008e50a61b788b51 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# systemctl daemon-reload | |
# systemctl enable redis-server.service | |
# systemctl enable redis-sentinel.service | |
# systemctl start redis-server.service | |
# systemctl start redis-sentinel.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Redis Sentinel | |
After=network.target | |
[Service] | |
User=redis | |
Group=redis | |
Environment=statedir=/var/run/sentinel | |
PermissionsStartOnly=true | |
PIDFile=/var/run/sentinel/redis.pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Redis In-Memory Data Store | |
After=network.target | |
[Service] | |
Type=forking | |
User=redis | |
Group=redis | |
LimitNOFILE=65536 | |
Environment=statedir=/var/run/redis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind 192.168.1.13 | |
port 16379 | |
sentinel monitor redis-cluster 192.168.1.11 6379 2 | |
sentinel down-after-milliseconds -redis-cluster 5000 | |
sentinel failover-timeout redis-cluster 60000 | |
sentinel auth-pass redis-cluster password | |
logfile "/var/log/redis/redis-sentinel.log" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind 192.168.1.12 | |
port 16379 | |
sentinel monitor redis-cluster 192.168.1.11 6379 2 | |
sentinel down-after-milliseconds redis-cluster 5000 | |
sentinel failover-timeout redis-cluster 60000 | |
sentinel auth-pass redis-cluster password | |
logfile "/var/log/redis/redis-sentinel.log" |