Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

A pure Go Redis-cli

Go Report Card

This is a simple redis-cli forked from Fully compatible with Redis Protocol specification.


  • Pure Go implementation
  • Full compatible with Redis Protocol specification
  • Basic support for hostname, port, auth, db
  • REPL
  • Non-interactively execute command
  • Raw format output
  • Monitor command support (both in REPL and execution directly)
  • CONNECT command support(example is as follows)


To install, use go get

go get -u -v 

or download binary file from release.


$ ./redis-cli --help
Usage of ./redis-cli:
  -a string
        Password to use when connecting to the server
  -h string
        Server hostname (default "")
  -n int
        Database number(default 0)
  -p int
        Server server port (default 6379)
        Use raw formatting for replies
  -s string
        Server socket. (overwrites hostname and port)

Almost the same as the official redis-cli.

$ ./redis-cli> get info

$ ./redis-cli --raw> get info

$ ./redis-cli get info

$ ./redis-cli --raw get info

$ ./redis-cli monitor
1483327130.764598 [0] "PING"
1483327133.769646 [0] "PING"
1483327136.768431 [0] "PING"
1483327139.767084 [0] "PING"

New command support: CONNECT host port [auth]

$ ./redis-cli> set hostport ""
OK> get hostport
""> connect 6380
connected successfully> get hostport

Play with GoTTY

gotty -w ./redis-cli --welcome


Why I build this?

Sometimes I would like to access to the redis-server(or redis-proxy), but there is no redis-cli in the the production machine which is controlled by the ops guys, and I don't have the root privilege to install one via apt-get or yum. Some people may ask that why don't you ask the ops guys for help? I just don't want to bother them because somtimes they are very busy, and I just want the redis-cli for single use. People may be curious that why don't I git clone one from github and build it from source.

Ok, let me show you:

git clone
Initialized empty Git repository in /home/work/app/redis/.git/
remote: Counting objects: 45784, done.
remote: Compressing objects: 100% (92/92), done.
Receiving objects:   0% (62/45784), 20.01 KiB | 5 KiB/s

Receiving objects:   0% (291/45784), 84.01 KiB | 1 KiB/s

Receiving objects:   2% (1242/45784), 300.01 KiB | 7 KiB/s

The network condition really drives me crazy.

People who has C/C++ backrground must know that you can't simply copy a linux executable file from one machine to another and make it run successfully, because sometimes the target machine lacks of the matched glibc or other .so files.

$ ldd redis-cli =>  (0x00007fffe93fe000) => /lib/x86_64-linux-gnu/ (0x00007f17ff5f9000) => /lib/x86_64-linux-gnu/ (0x00007f17ff3db000) => /lib/x86_64-linux-gnu/ (0x00007f17ff015000)
    /lib64/ (0x00007f17ff919000)

So I just want a pure go solution,build once, and run everywhere(aha Java).

Please correct me if I am wrong.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request


MIT LICENSE, see LICENSE for details.


David Chen (a.k.a holys)

You can’t perform that action at this time.