Redis - Server Role Command


Redis ROLE is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database. This command can be used both via Redis-cli and via telnet. The ability to see all the requests processed by the server is useful in order to spot bugs in an application, both while using Redis as a database and as a distributed caching system.


Following is the basic syntax of Redis ROLE command.

redis> ROLE 

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


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