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

相关推荐
сокол几秒前
【网安-Web渗透测试-靶场系列】AWD-Platform(ctf-hub)
linux·服务器·ubuntu·网络安全·docker
utf8mb4安全女神31 分钟前
Linux系统服务相关命令【定时任务设置】【任务进程管理】【防火墙区域应用】
linux·运维·服务器
解道Jdon1 小时前
[Budi插件:VsCode状态栏显示Copilot使用情况
ide·windows·git·svn·eclipse·github·visual studio
一个人旅程~2 小时前
如何避免在使用win安装U盘启动macbook时候出现键盘触摸板卡死的问题
windows·经验分享·macos·电脑
月走乂山3 小时前
Windows 10 WSL2 安装问题排查与解决全记录
windows·docker·hyper-v·故障排查·wsl2
jfqqqqq3 小时前
windows安装postgres的vector插件
windows
不吃土豆的马铃薯4 小时前
Spdlog 进阶:日志基本控制、日志格式控制、异步记录器
linux·服务器·开发语言·前端·c++
疯狂成瘾者4 小时前
常见的 Linux 版本
linux·运维·服务器
szxinmai主板定制专家4 小时前
基于ZYNQ MPSOC图像采集与压缩系统总体设计方案
linux·arm开发·人工智能·嵌入式硬件·fpga开发
Donk_674 小时前
ELK+Redis架构搭建
redis·elk·架构