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 一般都是从同一套源码编译出的,所以应该是一样的。

相关推荐
tech-share1 天前
【无标题】IOMMU功能测试软件设计及实现 (二)
linux·架构·系统架构·gpu算力
时兮兮时1 天前
Linux 服务器后台任务生存指南
linux·服务器·笔记
dz小伟1 天前
从用户空间open()到驱动open()的完整调用链深度解析
linux
DeeplyMind1 天前
第4章: MMU notifier内核实现机制
linux·驱动开发·mmu·mmu notifier
摸鱼仙人~1 天前
RAG 系统中的 TOC Enhance:用“目录增强”提升检索与生成效果
linux·运维·服务器
论迹1 天前
【Redis】-- 单线程模型
数据库·redis·缓存
xingzhemengyou11 天前
Linux dmesg 查看系统启动日志
linux
华如锦1 天前
一.2部署——大模型服务快速部署vLLM GPU 安装教程 (Linux)
java·linux·运维·人工智能·后端·python·vllm
Jacob程序员1 天前
Linux scp命令:高效远程文件传输指南
linux·运维·服务器
星火开发设计1 天前
Python数元组完全指南:从基础到实战
开发语言·windows·python·学习·知识·tuple