Redis-Cli (Redis command line)

Server

Language :

접속

$ redis-cli -c -h {redis-endpoint or host} -p {port}
127.0.0.1:6379>
  • 옵션 h: 기본값 localhost 면 생략 가능
  • 옵션 p: 기본값 6379면 생략 가능
  • redis-endpoint: EalstiCache 기본 엔드포인트에서 Port(:6379)를 제외한 전체

전송 중 데이터 암호화(TLS) 설정한 경우

$ redis-cli -c -h {redis-endpoint or host} -p {port} --tls
redis-endpoint:port> auth {redis-auth-token or password}
OK

Key 조회

redis-endpoint:port> keys {pattern}

Key 확인

redis-endpoint:port> get {key}

Key 생성

redis-endpoint:port> set {key} {value}

Key 삭제

redis-endpoint:port> del {key}

Key 조회하여 일괄 삭제

기본적으로 Redis는 패턴을 사용한 삭제를 지원하지 않음

redis-cli keys "*Program*" | xargs redis-cli del

전체 삭제

redis-endpoint:port> FLUSHALL

key 갯수 확인

redis-endpoint:port> DBSIZE

실행되는 명령어 확인

$ redis-cli monitor
OK
1671497361.715468 [0 172.18.0.6:35448] "SMEMBERS" "devdev"

memory 확인

127.0.0.1:6379> info memory

# Memory
used_memory:1165728
used_memory_human:1.11M
used_memory_rss:7856128
used_memory_rss_human:7.49M
used_memory_peak:1320304
used_memory_peak_human:1.26M
used_memory_peak_perc:88.29%
used_memory_overhead:897696
used_memory_startup:895712
used_memory_dataset:268032
used_memory_dataset_perc:99.27%
allocator_allocated:1686496
allocator_active:7536640
allocator_resident:8912896
total_system_memory:8233017344
total_system_memory_human:7.67G
used_memory_lua:31744
used_memory_vm_eval:31744
used_memory_lua_human:31.00K
used_memory_scripts_eval:0
number_of_cached_scripts:0
number_of_functions:0
number_of_libraries:0
used_memory_vm_functions:32768
used_memory_vm_total:64512
used_memory_vm_total_human:63.00K
used_memory_functions:184
used_memory_scripts:184
used_memory_scripts_human:184B
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:4.47
allocator_frag_bytes:5850144
allocator_rss_ratio:1.18
allocator_rss_bytes:1376256
rss_overhead_ratio:0.88
rss_overhead_bytes:-1056768
mem_fragmentation_ratio:6.86
mem_fragmentation_bytes:6711072
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_total_replication_buffers:0
mem_clients_slaves:0
mem_clients_normal:1800
mem_cluster_links:0
mem_aof_buffer:0
mem_allocator:jemalloc-5.2.1
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

민갤

Back-End Developer

백엔드 개발자입니다.