To check the version of Redis that is currently running, you can use the “redis-cli” command with the “info” command. This command returns a variety of information about the Redis server, including the version number.
You can run the command in the command line by typing:
$ redis-cli info | grep 'redis_version'
This command shows the version of Redis server running, the output will be like this:
redis_version:6.2.0
You can also check the version of Redis using the redis-server
command with the -v
option:
$ redis-server -v
This command returns the version of Redis server, the output will be like:
Redis server v=6.2.0 sha=00000000:0 malloc=libc bits=64 build=1f5e5c5e8dccc2f5
In python redis library
import redis
r = redis.Redis()
version = r.info()["redis_version"]
This will return the version of Redis as a string, for example, “6.0.8”.