Redis - Server Role Command


Advertisements

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.

Syntax

Following is the basic syntax of Redis ROLE command.

redis 127.0.0.1:6379> 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

Example

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" 
redis_server.htm
Advertisements