w3resource

Redis Server: ROLE

ROLE

The Redis ROLE command provides information on the role of a Redis instance in the context of replication, by returning if the instance is currently a master, slave, or sentinel.

Syntax:

ROLE

Available since

2.8.12.

Return Value

The command returns an array of elements. The first element is the role of the instance, as one of the following three strings:

  • master
  • slave
  • sentinel

Return Value Type

Array

Example: Redis ROLE

redis 127.0.0.1:6379> ROLE 
1) "master"
2) (integer) 3129659
3) 1) 1) "127.0.0.1"
      2) "9001"
      3) "3129242"
   2) 1) "127.0.0.1"
      2) "9002"
      3) "3129543"

Previous: MONITOR
Next: SAVE



Follow us on Facebook and Twitter for latest update.