본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)48k · #5599

redis

하는 일

Redis는 정보를 컴퓨터의 메모리에 빠르게 저장하는 시스템입니다. 데이터 접근 속도를 높이고, 작업 대기열을 관리하고, 실시간 데이터를 저장하는 데 쓰입니다.

사용하는 경우

  • ✓웹사이트를 데이터베이스에 과부하를 주지 않고 더 빠르게 만들고 싶을 때.
  • ✓사용자가 일정 시간 안에 할 수 있는 행동 횟수를 제한할 때(속도 제한).
  • ✓시스템의 서로 다른 부분 사이에 즉각적인 메시지를 보내야 할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/redis/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/redis/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“사용자 데이터를 저장하고 웹사이트 속도를 높이도록 Redis를 설정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

Redis는 사전처럼 키-값 쌍으로 데이터를 저장합니다. 이 데이터를 매우 빠르게 추가하고, 가져오고, 삭제할 수 있습니다. 데이터가 유실되지 않도록 주기적으로 디스크에 저장할 수도 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Redis

Configure, operate, and optimize Redis for caching, queues, rate limiting, and real-time data storage.

When to Use

  • You need a low-latency in-memory cache to reduce database load.
  • Your application requires rate limiting, session storage, or leaderboards.
  • You need pub/sub messaging between services.
  • You want a distributed lock or job queue backed by an in-memory store.

Prerequisites

  • Linux server or Docker.
  • Root or sudo access for package installation.
  • Redis 7.x recommended for production.

Installation and Setup

# Debian / Ubuntu
sudo apt update
sudo apt install -y redis-server

# RHEL / Amazon Linux
sudo dnf install -y redis

# Start and enable
sudo systemctl enable --now redis-server

# Verify
redis-cli ping
# Expected output: PONG

Core Configuration

Edit /etc/redis/redis.conf:

# Network
bind 0.0.0.0
port 6379
protected-mode yes
requirepass strong_redis_password

# Memory
maxmemory 2gb
maxmemory-policy allkeys-lru

# Connections
maxclients 10000
timeout 300
tcp-keepalive 60

# Logging
loglevel notice
logfile /var/log/redis/redis-server.log

# Security — disable dangerous commands in production
rename-command FLUSHALL ""
rename-command FLUSHDB ""
rename-command CONFIG ""
rename-command DEBUG ""
sudo systemctl restart redis-server

redis-cli Commands Reference

# Connect with authentication
redis-cli -a strong_redis_password

# Connect to a remote host
redis-cli -h 10.0.0.5 -p 6379 -a strong_redis_password

String Operations

SET user:1:name "Alice"
GET user:1:name

# Set with TTL (seconds)
SETEX session:abc123 3600 '{"userId":1}'

# Set only if key does not exist (distributed lock pattern)
SET lock:order:42 "worker-1" NX EX 30

# Increment counters
INCR page:views:/home
INCRBY api:quota:user:1 -1

Hash Operations

HSET user:1 name "Alice" email "alice@example.com" plan "pro"
HGET user:1 email
HGETALL user:1
HINCRBY user:1 login_count 1

List Operations (Queues)

LPUSH queue:emails '{"to":"alice@example.com","subject":"Welcome"}'
RPOP queue:emails
LLEN queue:emails

# Blocking pop (worker pattern)
BRPOP queue:emails 30

Set and Sorted Set Operations

# Sets — unique tags
SADD article:1:tags "redis" "database" "caching"
SMEMBERS article:1:tags
SISMEMBER article:1:tags "redis"

# Sorted sets — leaderboards
ZADD leaderboard 1500 "player:1" 2300 "player:2" 1800 "player:3"
ZREVRANGE leaderboard 0 9 WITHSCORES
ZINCRBY leaderboard 100 "player:1"
ZRANK leaderboard "player:2"

Key Management

KEYS user:*             # avoid in production — use SCAN instead
SCAN 0 MATCH user:* COUNT 100
TTL session:abc123
PERSIST session:abc123
DEL user:old
EXPIRE user:1 86400
TYPE user:1

Persistence

RDB Snapshots

# redis.conf — save snapshots at intervals
save 900 1       # snapshot if >= 1 key changed in 900 seconds
save 300 10      # snapshot if >= 10 keys changed in 300 seconds
save 60 10000    # snapshot if >= 10000 keys changed in 60 seconds

dbfilename dump.rdb
dir /var/lib/redis
rdbcompression yes

AOF (Append-Only File)

appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec    # good balance of safety and performance
# Options: always (safest, slowest), everysec (recommended), no (OS decides)

# AOF rewrite thresholds
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

Recommended Production Strategy

Use both RDB and AOF together. RDB provides fast restarts and compact backups. AOF provides durability down to 1-second granularity.

save 900 1
save 300 10
appendonly yes
appendfsync everysec

Redis Sentinel (High Availability)

Sentinel monitors Redis instances and performs automatic failover.

Sentinel Configuration

# /etc/redis/sentinel.conf
port 26379
sentinel monitor mymaster 10.0.0.1 6379 2
sentinel auth-pass mymaster strong_redis_password
sentinel down-after-milliseconds mymaster 5000
sentinel failover-timeout mymaster 60000
sentinel parallel-syncs mymaster 1

Run at least three Sentinel instances for quorum.

# Start Sentinel
redis-sentinel /etc/redis/sentinel.conf

# Query Sentinel
redis-cli -p 26379 SENTINEL masters
redis-cli -p 26379 SENTINEL get-master-addr-by-name mymaster
redis-cli -p 26379 SENTINEL replicas mymaster

Redis Cluster Mode

Cluster mode distributes data across multiple shards automatically.


…
자주 묻는 질문

Redis를 쓰려면 특별한 서버가 필요한가요?

꼭 그렇지는 않습니다. 일반 리눅스 서버에 설치하거나 Docker 같은 컨테이너로 쓸 수 있습니다.

Redis는 안전한가요?

네, 비밀번호로 보호할 수 있고, 운영 환경에서 위험한 명령을 쓰지 못하도록 설정할 수 있습니다.

'캐싱'이란 무엇인가요?

자주 쓰는 정보의 사본을 빠르게 접근할 수 있는 곳에 두어, 매번 원래 출처(데이터베이스 등)에서 가져오지 않아도 되게 하는 것입니다. 모든 것이 더 빨라집니다.

상세 정보

작성자의 원본 설명

Configure Redis for caching and data storage. Set up clustering, persistence, and Sentinel. Use when implementing Redis caching or queues.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5599
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬