Deny SYNC and PSYNC in redis-cli #1545

Merged
merged 1 commit into from Feb 23, 2014

Conversation

Projects
None yet
2 participants
@mattsta
Contributor

mattsta commented Feb 10, 2014

Running SYNC or PSYNC in the cli returns the
Redis replication stream as output, then upon encountering
the next command, redis-cli aborts because it's receiving
a replication stream instead of command output.

Trying to read the replication stream from redis-cli isn't useful (as it breaks the CLI and doesn't feed you ongoing output anyway).

If you want to view/debug a live replication stream, you should do cat <(echo sync) - | nc localhost 6379 instead.

@antirez

This comment has been minimized.

Show comment Hide comment
@antirez

antirez Feb 10, 2014

Owner

Matt what about instead just entering the --slave mode when those commands are detected? Maybe adding some output like Entering redis-cli slave mode... just to make clear that what they are going to see is processed output and not raw one.

Owner

antirez commented Feb 10, 2014

Matt what about instead just entering the --slave mode when those commands are detected? Maybe adding some output like Entering redis-cli slave mode... just to make clear that what they are going to see is processed output and not raw one.

Auto-enter slaveMode when SYNC from redis-cli
If someone asks for SYNC or PSYNC from redis-cli,
automatically enter slaveMode (as if they ran
redis-cli --slave) and continue printing the replication
stream until either they Ctrl-C or the master gets disconnected.
@mattsta

This comment has been minimized.

Show comment Hide comment
@mattsta

mattsta Feb 10, 2014

Contributor

Great idea! Updated.

Contributor

mattsta commented Feb 10, 2014

Great idea! Updated.

antirez added a commit that referenced this pull request Feb 23, 2014

@antirez antirez merged commit e163332 into antirez:unstable Feb 23, 2014

@antirez

This comment has been minimized.

Show comment Hide comment
@antirez

antirez Feb 23, 2014

Owner

Thank you! merged.

Owner

antirez commented Feb 23, 2014

Thank you! merged.

@mattsta mattsta deleted the mattsta:fix-redis-cli-sync branch Mar 26, 2014

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