Redis-cli#
The official CLI is the first thing that comes into mind. You can install the CLI in different ways:
- Via the package
redis-tools
in Debian based distributions. This package might be outdated (depending on your OS). With Homebrew, this package is not available (there is a tap that looks unmaintained) - As part of the package
redis-server
which includes Redis itself. This package might be outdated as well (depending on your OS) and installs the server component, which is not required. - Form the tarball with make. This requires some packages like gcc and some time as it is build from source, which is not ideal.
Example call
redis-cli -h localhost -p 6379 [--tls --skipVerify -a <password>]
redli#
Redli is a humane alternative to redis-cli that looks unmaintained and does not offer a Darwin ARM build. M1 Mac users must build it themself.
Example call
redli -h localhost -p 6379 [--tls --skipverify -a <password>]
nc and ncat#
You can use netcat (or nmap’s ncat) to check the connection as well!
#!/bin/bash
export REDISAUTH=<password>
export REDISHOST=localhost
export REDISPORT=6379
echo -e "*2\r\n\$4\r\nAUTH\r\n\$16\r\n$REDISAUTH\r\n*2\r\n\$4\r\nINFO\r\n\$5\r\nSTATS\r\n" | [nc|ncat] $REDISHOST $REDISPORT
Unfortunately, this was not working on my machine.
chkRedis#
Neither of these options was very pleasant on my M1 Mac, so I decided to write my own little helper tool to check the connection to a Redis data store.
The requirements were rather simple:
- Go and cross-platform build including Darwin ARM. By providing a cross-platform binary, I can benefit from the same functionality on every system even without the need of root permissions to install packages.
- Arguments to configure the address, TLS, skipVerify and a password.
- Execute
PING
command to verify the connection.