Here are four quick and easy ways to find out what version of Redis you’re using.
Option 1: The INFO
Command
If you’re already connected to Redis, you can use the INFO
command to return the Redis version:
INFO server
Example result:
# Server redis_version:6.2.6 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:c6f3693d1aced7d9 redis_mode:standalone os:Darwin 21.5.0 arm64 arch_bits:64 multiplexing_api:kqueue atomicvar_api:c11-builtin gcc_version:4.2.1 process_id:29680 process_supervised:no run_id:421213b8bcec62a47f96c073e6ce1c4450946a8a tcp_port:6379 server_time_usec:1655300672629833 uptime_in_seconds:474326 uptime_in_days:5 hz:10 configured_hz:10 lru_clock:11133504 executable:/opt/homebrew/opt/redis/bin/redis-server config_file:/opt/homebrew/etc/redis.conf io_threads_active:0
The Redis version is on the second line.
It’s also possible to run the INFO
command without any arguments, like this:
INFO
That returns a lot more information, such as info about the server, client connections, memory consumption, statistics, and more.
Option 2: redis-server --version
Another way to check the Redis version is with the --version
option of the redis-server
executable.
With this option, you run it from the command line – not from within Redis.
So, open a new command line and enter the following:
redis-server --version
Example result:
Redis server v=6.2.6 sha=00000000:0 malloc=libc bits=64 build=c6f3693d1aced7d9
You can alternatively replace --version
with -v
:
redis-server -v
Result:
Redis server v=6.2.6 sha=00000000:0 malloc=libc bits=64 build=c6f3693d1aced7d9
We can also use the Unix cut
command to narrow it down to just the version number:
redis-server -v | cut -d= -f2 | cut -d ' ' -f1
Result:
6.2.6
We can even go a step further and remove the patch-level version if we want:
redis-server -v | cut -d= -f2 | cut -d ' ' -f1 | cut -d. -f-2
Result:
6.2
Option 3: redis-cli INFO server
Another way to do it from the command line is with the redis-cli
terminal program. We can use this program to run a Redis command and receive its reply as standard output to the terminal.
Therefore, we can make use of the INFO
server command like we did with the first option.
But with this option, we can use grep
to extract just the line that contains the Redis version:
redis-cli INFO server | grep ^redis_version:
Result:
redis_version:6.2.6
We can also use the Unix cut
command to remove the label if required:
redis-cli INFO server | grep ^redis_version: | cut -d: -f2
Result:
6.2.6
And we can expand it further to exclude the patch-level version:
redis-cli INFO server | grep ^redis_version: | cut -d: -f2 | cut -d. -f-2
Result:
6.2
Option 4: Start Redis in Standalone Mode
If you’re running Redis in standalone mode, you should be able to find the Redis version with a quick glance.
To run Redis in standalone mode, run the redis-server
executable from the command line.
Here’s what happens when I start Redis in standalone mode on my Mac:
redis-server
Result:
37673:C 15 Jun 2022 21:59:59.925 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 37673:C 15 Jun 2022 21:59:59.925 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=37673, just started 37673:C 15 Jun 2022 21:59:59.925 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 37673:M 15 Jun 2022 21:59:59.926 * Increased maximum number of open files to 10032 (it was originally set to 2560). 37673:M 15 Jun 2022 21:59:59.926 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 6.2.6 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 37673 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 37673:M 15 Jun 2022 21:59:59.928 # Server initialized 37673:M 15 Jun 2022 21:59:59.929 * Loading RDB produced by version 6.2.6 37673:M 15 Jun 2022 21:59:59.929 * RDB age 478901 seconds 37673:M 15 Jun 2022 21:59:59.929 * RDB memory usage when created 0.98 Mb 37673:M 15 Jun 2022 21:59:59.929 # Done loading RDB, keys loaded: 0, keys expired: 0. 37673:M 15 Jun 2022 21:59:59.929 * DB loaded from disk: 0.000 seconds 37673:M 15 Jun 2022 21:59:59.929 * Ready to accept connections
To stop it, enter Ctrl-C
.