How to know status of redis from command line (redis-cli) ? master/slave
You can also use monitor to see what Sentinel is doing: $ redis-cli -p 6379 monitor OK 1546981642.808843 [0 127.0. 0.1:54765] "PING" 1546981642.866671 [0 127.0. 0.1:54765] "PUBLISH" "__sentinel__:hello" "127.0.
The quorum was set to the value of 2 (last argument of sentinel monitor configuration directive). The down-after-milliseconds value is 5000 milliseconds, that is 5 seconds, so masters will be detected as failing as soon as we don't receive any reply from our pings within this amount of time.
The INFO command returns the current role.
e.g/ if we're the master
role:master
will be shown, amongst other details.
And if we switch to a slave, maybe by using slaveof:
slaveof 192.168.1.66 6379
We get more, when we run INFO:
role:slave master_host:192.168.1.66 master_port:6379 master_link_status:down master_last_io_seconds_ago:-1 master_sync_in_progress:0 master_link_down_since_seconds:1341313174
EDIT: Here's a succinct cli command as shown by Linus (but who's just deleted his post):
redis-cli info | grep ^role
:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With