Cheat Sheet #day32 - RedisInsight

Cheat Sheet #day32 - RedisInsight

Here’s a RedisInsight cheatsheet to help you get started with using this powerful GUI tool for managing Redis:


RedisInsight Cheatsheet

Installation

  • Download RedisInsight: RedisInsight Download Page

  • Install on macOS:

      brew install --cask redisinsight
    
  • Install on Linux:

      wget https://download.redisinsight.redis.com/latest/redisinsight-linux64.deb
      sudo dpkg -i redisinsight-linux64.deb
    
  • Install on Windows:

    • Download the installer and run the .exe file from the RedisInsight download page.

Connecting to a Redis Database

  1. Open RedisInsight and click on "Add Redis Database".

  2. Enter connection details:

    • Host: Redis server hostname or IP address.

    • Port: Redis server port (default is 6379).

    • Password: Password if Redis is password-protected.

    • Alias: Optional name for the connection.

  3. Click "Add Database" to connect.

Main Features

  • Dashboard: Overview of connected Redis instances, key statistics, and performance metrics.

  • Browser: Explore and manage Redis keys with filtering and pattern matching.

  • CLI: Execute Redis commands directly from RedisInsight.

  • Info: View detailed server information and statistics.

  • Memory Analysis: Analyze memory usage and get insights into data structure allocations.

  • Slow Log: Monitor slow queries and identify performance bottlenecks.

Key Operations

  • Viewing Keys:

    • Use the browser pane to filter and search for keys.

    • Click on a key to view its details and value.

  • Creating Keys:

    • Click on "New Key" in the browser pane.

    • Select the data type (String, Hash, Set, List, Sorted Set, Stream).

    • Enter key name and value, then click "Create".

  • Editing Keys:

    • Select a key and click "Edit" to modify its value.

    • For complex types like Hash, List, and Set, you can add, edit, or delete individual elements.

  • Deleting Keys:

    • Select a key and click "Delete" to remove it from the database.

Memory Analysis

  • Run Memory Analysis:

    • Go to the "Memory" section.

    • Click "Analyze" to perform a memory analysis.

  • View Results:

    • Examine the memory usage by data structure and key.

    • Identify large keys and memory-consuming data types.

Slow Log Monitoring

  • View Slow Logs:

    • Go to the "Slow Log" section.

    • View the list of slow queries executed on the Redis server.

  • Analyze Slow Logs:

    • Click on a slow log entry to view details about the query and execution time.

    • Use this information to optimize query performance.

Backup and Restore

  • Backup:

    • Use the CLI to run the BGSAVE command to create a backup of the Redis database.
  • Restore:

    • To restore, stop the Redis server, replace the dump.rdb file with the backup file, and restart the server.

CLI Commands

  • Basic Commands:

    • SET key value: Set a key to a specified value.

    • GET key: Get the value of a key.

    • DEL key: Delete a key.

  • Advanced Commands:

    • INFO: Get information and statistics about the server.

    • FLUSHDB: Remove all keys from the current database.

    • FLUSHALL: Remove all keys from all databases.

Tips and Tricks

  • Use Patterns: Use wildcard patterns (*, ?) in the browser to filter keys.

  • Monitor Performance: Regularly check the slow log and memory analysis to ensure optimal performance.

  • Automate Backups: Schedule regular backups using cron jobs or similar scheduling tools.


RedisInsight is a comprehensive tool that simplifies managing and monitoring Redis databases. This cheatsheet provides a quick reference to its core functionalities, helping you to leverage RedisInsight effectively in your daily operations.

Did you find this article valuable?

Support Cloud Tuned by becoming a sponsor. Any amount is appreciated!