Skip to content

redis-cli --cluster tries to broadcast a command to all the shards including slaves #6474

@hengku

Description

@hengku
$src/redis-cli --cluster call 127.0.0.1:8101 set Key1 Value1
>>> Calling set Key1 Value1
127.0.0.1:8101: OK
127.0.0.1:8103: MOVED 5291 127.0.0.1:8101
127.0.0.1:8102: MOVED 5291 127.0.0.1:8101

It succeeds in one shard but attempts writing to multiple shards.

Is it worth to introduce some command-line flags to control the numbers of shards a command can go to?

  • specific flag only sends a command to a specific shard and prints the response like below
$src/redis-cli --cluster --spcific call 127.0.0.1:8101 set Key1 Value1 
>>> Calling set Key1 Value1 specifically on 127.0.0.1:8101
OK
  • masters flag will broadcast a command only to all masters. A large cluster may have too many slaves and we don't want the response from them
$src/redis-cli --cluster --master call 127.0.0.1:8101 set Key1 Value1 
>>> Calling set Key1 Value1 to all Masters
.
  • slaves flag will broadcast a command only to all slaves. For example, the read commands or replication info may go to slaves only.
$src/redis-cli --cluster --slaves call 127.0.0.1:8101 set Key1 Value1 
>>> Calling set Key1 Value1 to all slaves
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions