Redis Server: ROLE
Redis ROLE Command
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.
Here are some common uses and scenarios for the "ROLE" command:
- Role Identification: Returns the role of the current Redis server instance (e.g., master or replica), useful for understanding its function in a Redis cluster.
- Cluster Management: Assists in managing Redis clusters by providing information on the roles of different nodes.
- Troubleshooting: Helps in diagnosing issues by identifying the role of the server and verifying its proper configuration.
- Monitoring: Useful for monitoring cluster status and node roles, ensuring that master and replica nodes are correctly assigned.
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"
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/redis/redis-server-role.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics