-
Notifications
You must be signed in to change notification settings - Fork 23.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW]Add a command to get the number of replicas. #10852
Comments
seems related to #8684 |
@oranagra Put the wait command aside. Let's discuss the new command. Is it feasible to add this new command for future needs? For example, for some possible commands in the future that require the |
@ncghost1 it is unlikely that we'll add a dedicated command just to get that specific piece of info. |
This means that we can use our eyes to get the information in the INFO command, but in the code implementation, it need to match and split the string to get specific information. Thank you for your suggestion. I will try to use ROLE. Then I will close the issue. |
The problem/use-case that the feature addresses
When I want to use the
wait
command in my code, I want thenumreplica
to be equal to the number of all replicas,but redis does not provide a command that can return the number of replicas.If mytimeout
is 0 andnumreplicas
exceed the actual number, it will be blocked forever.Currently, we can only use the
info
command to seeconnected_ Slaves: (number)
, but the code has no eyes. I can only let the code do a series of string operations to get it, which makes the code more complex and increases the code execution time.(Or is there another way to get it? Please let me know if there is a better way)I think redis needs to provide a command to return the number of replicas. This is to provide a reference for the
numreplicas
parameter of thewait
command and other purposes.Description of the feature
A command that returns the number of slave nodes connected to the current master node,maybe we can call it
numofreplicas
.The text was updated successfully, but these errors were encountered: