Check Redis server version
Asked Answered
U

7

278

how to check Redis server version?

I've found in Redis site this command:

$ redis-server

and that should give me (according to the site):

[28550] 01 Aug 19:29:28 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[28550] 01 Aug 19:29:28 * Server started, Redis version 2.2.12
[28550] 01 Aug 19:29:28 * The server is now ready to accept connections on port 6379
... and so forth ...

but I get this instead:

[8719] 04 Feb 14:51:09.009 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[8719] 04 Feb 14:51:09.009 # Unable to set the max number of files limit to 10032 (Operation not permitted), setting the max clients configuration to 3984.
[8719] 04 Feb 14:51:09.009 # Creating Server TCP listening socket *:6379: bind: Address already in use

Which mean I need to configure it, but all I want is the version!

So how do I check Redis server version?

Upwind answered 4/2, 2014 at 15:3 Comment(0)
U
431

$ redis-server --version

gives you the version.

Upwind answered 4/2, 2014 at 15:3 Comment(5)
This doesn't give you the currently running version though. I had upgraded a server to 3.2.8 via yum, and this command showed the new version, but the server needed to be restarted manually to launch the new version, whereas INFO correctly reported the old version.Imaginal
@Imaginal is right. I'm surprised this wrong answer is highly upvoted.Brambling
the advantage of redis-server --version is that it can be run even when the server is down (e.g. in a Jenkins pipeline when testing a Redis container), while redis-cli info <subinfo> will succeed only in a complete working setup, with redis-server running and responsive and with open network connectivity between redis-cli and redis-serverNephralgia
I landed here trying to figure out "I've got an application that's a client of a redis server, how do I discover its version?", where I'm not even able to login to the server. Issuing the info command got me the answer. (Which, reading more carefully, wouldn't have helped OP. Still, I think most readers will find issuing info from a client more helpful than running redis-server on the host.Waylen
Podman container version: podman exec -it redis sh -c "redis-server --version"Orthocephalic
A
241

Run the command INFO. The version will be the first item displayed.

The advantage of this over redis-server --version is that sometimes you don't have access to the server (e.g. when it's provided to you on the cloud), in which case INFO is your only option.

Albuquerque answered 5/2, 2014 at 3:45 Comment(4)
when your redis fails to start — you can't have access to server: Could not connect to Redis at 127.0.0.1:6379: Connection refused So it's better to know where your redis-cli is and then asks through --version thereScintillant
Gives you lots of other info too... such as key hits and misses and uptime.Darceldarcey
@markthegrea valid point, I updated my answer since some people didn't see the advantage.Albuquerque
redis-cli INFO SERVER | grep redis_versionDownstroke
M
57

To support the answers given above, The details of the redis instance can be obtained by

$ redis-cli
$ INFO

This gives all the info you may need

# Server
redis_version:5.0.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:da75abdfe06a50f8
redis_mode:standalone
os:Linux 5.3.0-51-generic x86_64
arch_bits:64
multiplexing_api:epoll
atomicvar_api:atomic-builtin
gcc_version:7.5.0
process_id:14126
run_id:adfaeec5683d7381a2a175a2111f6159b6342830
tcp_port:6379
uptime_in_seconds:16860
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:15766886
executable:/tmp/redis-5.0.5/src/redis-server
config_file:

# Clients
connected_clients:22
....More Verbose

The version lies in the second line :)

Meteor answered 22/6, 2020 at 11:31 Comment(0)
B
24

There are two commands, which you can use to check the version of redis

    redis-server -v

or

    redis-server --version
Bollay answered 21/1, 2019 at 8:18 Comment(0)
S
18

if you want to know a remote redis server's version, just connect to that server and issue command "info server", you will get things like this:

...
redis_version:3.2.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:9c3b73db5f7822b7
redis_mode:standalone
os:Linux 2.6.32.43-tlinux-1.0.26-default x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.9.4
process_id:5034
run_id:a45b2ffdc31d7f40a1652c235582d5d277eb5eec
Sirrah answered 29/9, 2018 at 9:7 Comment(0)
E
11

To get the version of Redis server

redis-server -v

To get the version of Redis client

redis-cli -v

Eanore answered 11/5, 2020 at 8:47 Comment(0)
V
3

As noted in a comment by A. Tolstoy, you can use one of these:

$ redis.cli info server | grep ^redis_version:
redis_version:6.2.6

$ redis.cli info server | grep ^redis_version: | cut -d: -f2 
6.2.6

$ redis.cli info server | grep ^redis_version: | cut -d: -f2 | cut -d. -f-2
6.2
Versify answered 17/2, 2022 at 8:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.