Skip to content

Conversation

@thandayuthapani
Copy link
Contributor

@hengku @itamarhaber Please have a look

Related to https://github.com/antirez/redis/issues/6474

Output Log:
Default Option:

src/redis-cli --cluster call 127.0.0.1:6001 set key1 value1
>>> Calling set key1 value1
127.0.0.1:6001: MOVED 9189 127.0.0.1:6002

127.0.0.1:7001: MOVED 9189 127.0.0.1:6002

127.0.0.1:6003: MOVED 9189 127.0.0.1:6002

127.0.0.1:6002: OK
127.0.0.1:7002: MOVED 9189 127.0.0.1:6002

127.0.0.1:7003: MOVED 9189 127.0.0.1:6002

Master Option:

src/redis-cli --cluster call 127.0.0.1:6001 master set key2 value1
>>> Calling set key2 value1
127.0.0.1:6001: OK
127.0.0.1:6003: MOVED 4998 127.0.0.1:6001

127.0.0.1:6002: MOVED 4998 127.0.0.1:6001

Slave Option:

src/redis-cli --cluster call 127.0.0.1:6001 slave set key2 value1
>>> Calling set key2 value1
127.0.0.1:7001: MOVED 4998 127.0.0.1:6001

127.0.0.1:7002: MOVED 4998 127.0.0.1:6001

127.0.0.1:7003: MOVED 4998 127.0.0.1:6001

@thandayuthapani
Copy link
Contributor Author

Did not use --master or --slave, since there is already a --slave sub-command, for slave mode. So it might create conflict while parsing the command.

@artix75
Copy link
Contributor

artix75 commented Oct 23, 2019

Why do you want to use the call subcommand with redis set command?

@thandayuthapani
Copy link
Contributor Author

@artix75 This PR is related to this issue #6474. Have included output log just to show expected behaviour as shown in that issue. So have used call and set in the above log.

@thandayuthapani
Copy link
Contributor Author

I have currently implemented the command like this,
src/redis-cli --cluster call 127.0.0.1:6001 **master/slave** set key2 value1
Or I can implement like this also
src/redis-cli --cluster call **master/slave** 127.0.0.1:6001 set key2 value1

Or if you want me to implement in some other way, can you let me know. So I can make those changes?

This change might not be necessary for set command, but it might be useful for calling all slaves for setting masterauth instead of setting it in each slave separately. This is one case where call subcommand can be used to set some configs like masterauth in all slaves, when in master side Auth is enabled using requirepass config.

@artix75 Can you suggest any modification if necessary so that I can work on that.

@artix75
Copy link
Contributor

artix75 commented Oct 24, 2019

@thandayuthapani I just asked since the use-case of your example is quite weird/rare (it makes no sense IMHO to use the call subcommand with Redis commands involving keys, such as the set command).

Anyway, I'd suggest using the conventional --cluster-* pattern for the command-line options. So, instead of master or slave, you could name them --cluster-only-masters or --cluster-only-slaves.

@hengku
Copy link

hengku commented Oct 24, 2019

Hi @thandayuthapani , I checked current command-line options and agreed with @artix75 . What I am understanding is: '--cluster-only-masters' or '--cluster-only-slaves' specifies on which Redis servers we want to operate; the sub-commands specify which operations we want to execute.

@thandayuthapani
Copy link
Contributor Author

@artix75 Have made those changes. Please have a look.

Copy link
Contributor

@artix75 artix75 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remind to document new command options (--cluster-only-*) in the --cluster help too (see the clusterManagerCommandHelp function). Thank you.

@thandayuthapani
Copy link
Contributor Author

@artix75 Have made those changes.. Please have a look.

@thandayuthapani
Copy link
Contributor Author

@artix75 Have made those changes. Please have a look.

@thandayuthapani
Copy link
Contributor Author

@artix75 Is there any other changes to be done for this PR?

@artix75
Copy link
Contributor

artix75 commented Nov 7, 2019

@artix75 Is there any other changes to be done for this PR?

Now it's ok for me. Could you compact this PR in just one commit, in order to avoid all those "Addressed review comments" commits?

@thandayuthapani
Copy link
Contributor Author

@artix75 Have squashed all those commits into single commit.

@artix75
Copy link
Contributor

artix75 commented Nov 8, 2019

@artix75 Have squashed all those commits into single commit.

@thandayuthapani It's ok for me, thank you.
@antirez This can be merged.

@thandayuthapani
Copy link
Contributor Author

@antirez I hope this PR can be merged. @artix75 is okay with this enhancement.

@thandayuthapani
Copy link
Contributor Author

Hi @antirez, can you please take a look this PR to see if it can be merged?

itamarhaber
itamarhaber previously approved these changes Sep 2, 2020
Copy link
Member

@itamarhaber itamarhaber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @thandayuthapani - sorry for the long delay, I think this can be finally merged, thanks.

@itamarhaber
Copy link
Member

Fixes #6474

@itamarhaber itamarhaber merged commit f22f64f into redis:unstable Sep 2, 2020
oranagra pushed a commit that referenced this pull request Sep 10, 2020
* Add master/slave option in --cluster call command

* Update src/redis-cli.c

* Update src/redis-cli.c

Co-authored-by: Itamar Haber <itamar@redislabs.com>
(cherry picked from commit f22f64f)
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Nov 4, 2020
…is#6491)

* Add master/slave option in --cluster call command

* Update src/redis-cli.c

* Update src/redis-cli.c

Co-authored-by: Itamar Haber <itamar@redislabs.com>
jschmieg pushed a commit to memKeyDB/memKeyDB that referenced this pull request Nov 6, 2020
…is#6491)

* Add master/slave option in --cluster call command

* Update src/redis-cli.c

* Update src/redis-cli.c

Co-authored-by: Itamar Haber <itamar@redislabs.com>
(cherry picked from commit f22f64f)
@amberpharswan
Copy link

Please update PR description for sample commands.
Example, I am connecting to Redis7.1 elasticache with auth.
This works: redis6-cli -a "password" --tls --cluster call clustercfg.asdfghjkl.use1.cache.amazonaws.com:6379 KEYS "pattern*"

but this doesn't: redis6-cli -a "password" --tls --cluster-only-masters call clustercfg.asdfghjkl.use1.cache.amazonaws.com:6379 KEYS "pattern*"
cluster-only-masters is picking localhost as host somehow
Error: Could not connect to Redis at 127.0.0.1:6379: Connection refused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants