redis:常用客戶端命令(redis-cli)

刘宏缔的架构森林發表於2024-07-10

一,檢視redis所有配置

使用命令:

CONFIG GET *

例:

127.0.0.1:6379> CONFIG GET *
  1) "cluster-announce-bus-port"
  2) "0"
  3) "syslog-ident"
  4) "redis"
  5) "enable-module-command"
  6) "no"
  7) "min-slaves-to-write"
  8) "0"
  9) "cluster-enabled"
 10) "no" 

二,檢視單個配置

127.0.0.1:6379> config get aof-use-rdb-preamble
1) "aof-use-rdb-preamble"
2) "yes"

三,檢視全部狀態

127.0.0.1:6379> info
# Server
redis_version:7.2.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:980b4f44272b36a1
redis_mode:standalone
os:Linux 5.14.0-437.el9.x86_64 x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:11.4.1
process_id:248074
process_supervised:no
....

四,檢視單個狀態:

127.0.0.1:6379> info cpu
# CPU
used_cpu_sys:13.881941
used_cpu_user:13.274817
used_cpu_sys_children:0.001730
used_cpu_user_children:0.000563
used_cpu_sys_main_thread:13.880884
used_cpu_user_main_thread:13.274786
127.0.0.1:6379> info memory
# Memory
used_memory:1186112
used_memory_human:1.13M
used_memory_rss:10878976
used_memory_rss_human:10.38M
used_memory_peak:1406384
used_memory_peak_human:1.34M
used_memory_peak_perc:84.34%
used_memory_overhead:868232
...

五,檢視redis的版本:

127.0.0.1:6379> info server
# Server
redis_version:7.2.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:980b4f44272b36a1
redis_mode:standalone
os:Linux 5.14.0-437.el9.x86_64 x86_64
...

[sysop@blog conf]$ /usr/local/soft/redis7/bin/redis-cli --version
redis-cli 7.2.5

相關文章