Перейти к содержанию
Skillpedia
Код в целом48k · #5598

redis-cli

Что он делает

redis-cli это инструмент для прямого обращения к базе данных Redis с вашего компьютера. Он позволяет просматривать, изменять и управлять данными, которые хранятся в Redis.

Когда использовать

  • ✓Когда нужно посмотреть, что хранится под определенным ключом Redis.
  • ✓Чтобы добавить или изменить значение для ключа Redis.
  • ✓Чтобы проверить, корректно ли работает Redis.

Ссылка на скилл

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

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/redis-cli/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Как посмотреть значение ключа «user:123» в Redis?”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Вы вводите команды в терминале, как будто разговариваете с Redis. Утилита может работать в прямом режиме (одна команда, и она завершается) или в интерактивном режиме (вы продолжаете диалог с ней).

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

redis-cli — Redis Command Line Interface

When to Use

Use this skill when you need redis command-line interface (redis-cli) reference and usage guide. Use this skill whenever the user mentions redis-cli, Redis CLI, or any task involving querying, inspecting, debugging, or managing Redis from the command line. Triggers on key/value reads and writes, SCAN or keyspace...

redis-cli is the primary command-line tool for interacting with Redis. It supports two modes: command-line execution (run a command and exit) and interactive mode (a REPL with tab completion, history, and hints). It also provides special modes for monitoring, latency analysis, key space scanning, and data import/export.

Official resources: Redis CLI Docs | Commands | Download

Prerequisites

# Check if redis-cli is installed
redis-cli --version

# Install options:

# macOS (Homebrew)
brew install redis

# Ubuntu / Debian
sudo apt install redis-tools

# CentOS / RHEL
sudo yum install redis

# Alpine
apk add redis

# Build from source (binary only)
make redis-cli
# Binary at: src/redis-cli

# Docker (no installation needed)
docker run -it --rm redis redis-cli -h <host> -p <port> PING

Security Considerations

IMPORTANT: Redis provides powerful operations that can irreversibly modify or delete data. Pay close attention to the following safety guidelines:

  • Never pass passwords via -a in production — visible in shell history and process listings. Use REDISCLI_AUTH environment variable instead.
  • KEYS * blocks the server on large databases — always use SCAN in production code.
  • MONITOR logs all commands including sensitive data — use cautiously, and never for extended periods on production servers.
  • FLUSHALL / FLUSHDB are irreversible — verify target database with CLIENT LIST or INFO keyspace first.
  • --rdb transfer during write operations may produce inconsistent snapshots on busy servers.

Quick Reference

Connection

# Basic connection (default: 127.0.0.1:6379)
redis-cli
redis-cli -h redis15.localnet.org -p 6390 PING

# With password (prefer REDISCLI_AUTH env var for security)
redis-cli -a myUnguessablePazzzzzword123 PING

# URI connection
redis-cli -u redis://user:password@host:port/dbnum PING

# TLS
redis-cli --tls --cacert /path/to/ca.crt -h redis.example.com PING

# Specific database
redis-cli -n 2 DBSIZE

# IPv4/IPv6 preference
redis-cli -4 PING   # prefer IPv4
redis-cli -6 PING   # prefer IPv6

Command-Line vs Interactive Mode

# Command-line mode: execute one command and exit
redis-cli INCR mycounter
redis-cli GET mykey

# Interactive mode: type commands at the prompt
redis-cli
127.0.0.1:6379> PING
PONG
127.0.0.1:6379> SELECT 2
OK
127.0.0.1:6379[2]> DBSIZE
(integer) 1

The prompt shows host:port[db]. Use CONNECT <host> <port> to switch instances interactively.

Data Query Cheat Sheet

String operations (O(1)):

GET key                        # Get value
SET key value [NX|XX] [EX sec|PX ms|KEEPTTL]  # Set with conditions/TTL
SET key value GET              # Set new, return old value
GETSET key newvalue            # [Use SET key value GET instead]
MGET key1 key2 ...             # Get multiple values
INCR key                       # Increment integer (+1)
INCRBY key 10                  # Increment by amount
STRLEN key                     # String length
GETRANGE key 0 50              # Substring

Hash operations:

HGET key field                 # Get field value            O(1)
HMGET key f1 f2                # Get multiple fields        O(N)
HGETALL key                    # Get all fields/values      O(N)
HKEYS key                      # Get all field names        O(N)
HLEN key                       # Number of fields           O(1)
HEXISTS key field              # Check field exists         O(1)
HSCAN key 0 [MATCH pat]        # Iterate hash fields        O(1) per call

List operations:

LRANGE key 0 -1                # Get all elements           O(N)
LLEN key                       # List length                O(1)
LINDEX key 0                   # Get by index               O(N)
LPOS key value                 # Find element position      O(N)

Set operations:

SMEMBERS key                   # Get all members            O(N)

…
Частые вопросы

Как установить redis-cli?

Его можно установить с помощью менеджеров пакетов: Homebrew (macOS), apt (Ubuntu/Debian) или yum (CentOS/RHEL). Также его можно использовать через Docker.

Безопасно ли указывать пароль прямо в команде?

Это не рекомендуется. В продакшене используйте переменную окружения REDISCLI_AUTH вместо того, чтобы вводить пароль прямо в команде, так как он может сохраниться в истории команд.

Какую команду использовать, чтобы увидеть все ключи?

Команда `KEYS *` может заблокировать сервер на больших базах данных. В продакшене лучше использовать команду `SCAN`, чтобы безопасно получить список ключей.

Подробности

Оригинальное описание автора

Redis command-line interface (redis-cli) reference and usage guide. Use this skill whenever the user mentions redis-cli, Redis CLI, or any task involving querying, inspecting, debugging, or managing Redis from the command line.

repo: sickn33/agentic-awesome-skills

Популярность

Звёзды на GitHub
48k
Место в рейтинге
#5598
Лицензия
MIT
Обновлён
15.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы