Repository navigation
Conversation
Contributor
|
It looks like you're trying to reconnect by typing "connect" again? Any command typed will try to automatically reconnect to a Redis server, so you only run "connect IP port" if you want to connect to a different server. Example: % ./redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> set a b
Could not connect to Redis at 127.0.0.1:6379: Connection refused
[redis server started in another terminal window]
not connected> set a b
OK
127.0.0.1:6379> Notice how the last "set a b" caused redis-cli to auto-connect to the server it was originally trying to talk to. |
Author
|
Yes, I try "connect" without ip and port. The auto-connect is successful but the error prompt I think is misleading. |
Contributor
|
Yeah, that does make sense. It shouldn't be sending 'connect' to the server since it's a local request. |
mattsta
added a commit
to mattsta/redis
that referenced
this pull request
Oct 31, 2014
Also add an alias for connect to "con" because typing "connect" takes too long. New cli commands (with shorthand options): - enable/en cluster = enable cluster mode - disable/dis/no cluster = disable cluster mode Example usage: 127.0.0.1:7000> get a (error) MOVED 15495 127.0.0.1:7002 127.0.0.1:7000> en cluster 127.0.0.1:7000> get a -> Redirected to slot [15495] located at 127.0.0.1:7002 (nil) 127.0.0.1:7002> (The first "get" fails with MOVED, then we "en cluster" to enable cluster redirect following, then the second "get" follows the MOVED and works.) This commit also keeps client-only commands on the client so they don't leak to the server. Fixes redis#2112 as well
mattsta
added a commit
to mattsta/redis
that referenced
this pull request
Dec 11, 2014
Also add an alias for connect to "con" because typing "connect" takes too long. New cli commands (with shorthand options): - enable/en cluster = enable cluster mode - disable/dis/no cluster = disable cluster mode Example usage: 127.0.0.1:7000> get a (error) MOVED 15495 127.0.0.1:7002 127.0.0.1:7000> en cluster 127.0.0.1:7000> get a -> Redirected to slot [15495] located at 127.0.0.1:7002 (nil) 127.0.0.1:7002> (The first "get" fails with MOVED, then we "en cluster" to enable cluster redirect following, then the second "get" follows the MOVED and works.) This commit also keeps client-only commands on the client so they don't leak to the server. Fixes redis#2112 as well
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi all,
When redis-cli re-connects (for example, reboot server and then reconnect) to redis-server without explicit ip and port, redis-cli will run cliConnect(1) and then send a "connect" command to the server (see redis-cli.c:942).
Then, redis-cli will show an error prompt "(error) ERR unknown command 'connect'", even if the connection is successful.
I think the prompt is misleading, and suggest to modify the codes around redis-cli.c:917, which is straightforward.
Best regards
Min Fu