Windows 和 Linux 系统下,如何查看 Redis 的版本号?

一、Windows 下查看 Redis 版本号
1.1 打开 Redis 所在目录,启动 redis-server 服务器端

进入 Redis 所在目录 C:Program Files edis-latest>,然后在路径上输入 cmd 后回车,即可打开 cmd 窗口,打开后路径直接指向【C:Program Files edis-latest>】,启动 redis-server。

复制代码
C:Program Filesredis-latest>redis-server.exe redis.windows.conf
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.0.503 (00000000/0) 64 bit
  .-`` .-```.  ```/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 15932
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

[15932] 05 Jul 11:20:41.064 # Server started, Redis version 3.0.503
[15932] 05 Jul 11:20:41.067 * DB loaded from disk: 0.001 seconds
[15932] 05 Jul 11:20:41.067 * The server is now ready to accept connections on port 6379

启动后可以看见 Redis 版本号是 Redis 3.0.503。也可以按照下述步骤登录客户端查看。

1.2 启动 redis-cli 客户端
复制代码
C:Program Filesredis-latest>redis-cli
127.0.0.1:6379> auth 123456
OK
1.3 客户端输入:info
复制代码
127.0.0.1:6379> info
# Server
redis_version:3.0.503
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:d14575c6134f877
redis_mode:standalone
os:Windows
arch_bits:64
multiplexing_api:WinSock_IOCP
process_id:3348
run_id:02ecd2797e8922e4a9164f37858158b2c51681b2
tcp_port:6379
uptime_in_seconds:109
uptime_in_days:0
hz:10
lru_clock:12823277
config_file:C:Program Filesredis-latestredis.windows.conf

# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:693600
used_memory_human:677.34K
used_memory_rss:655832
used_memory_peak:693600
used_memory_peak_human:677.34K
used_memory_lua:36864
mem_fragmentation_ratio:0.95
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1656990336
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok

# Stats
total_connections_received:4
total_commands_processed:1
instantaneous_ops_per_sec:0
total_net_input_bytes:163
total_net_output_bytes:139
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0

# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:0.27
used_cpu_user:0.33
used_cpu_sys_children:0.00
used_cpu_user_children:0.00

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=5,expires=0,avg_ttl=0

从上述结果中的 # Server 结果可知,Redis 版本号为 3.0.503。

二、Linux 下查看 Redis 版本号

Linux 下查看 Redis 版本号有两种方式。

2.1 查看服务端版本
复制代码
[testuser@vm-11-211-41-22 redis]$ redis-server --version
Redis server v=4.0.8 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=4518454c6363c2d8

[testuser@vm-11-211-41-22 redis]$ redis-server -v
Redis server v=4.0.8 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=4518454c6363c2d8
2.2 查看客户端版本
复制代码
[testuser@vm-11-211-41-22 redis]$ redis-cli -v
redis-cli 4.0.8

[testuser@vm-11-211-41-22 redis]$ redis-cli --version
redis-cli 4.0.8

结果显示,Linux 系统的 Redis 版本号是 4.0.8。

严格来讲,通过 redis-cli 得到的结果应该是 redis-cli 的版本,但是 redis-cli 和 redis-server 一般都是从同一套源码编译出的,所以应该是一样的。

相关推荐
深紫色的三北六号6 小时前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash10 小时前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI20 小时前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行2 天前
Linux和window共享文件夹
linux
木心月转码ing2 天前
WSL+Cpp开发环境配置
linux
埃博拉酱3 天前
VS Code Remote SSH 连接 Windows 服务器卡在"下载 VS Code 服务器":prcdn DNS 解析失败的诊断与 BITS 断点续传
windows·ssh·visual studio code
崔小汤呀3 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应3 天前
vi编辑器使用
linux·后端·操作系统
何中应3 天前
Linux进程无法被kill
linux·后端·操作系统
何中应3 天前
rm-rf /命令操作介绍
linux·后端·操作系统