Connect Retool to Redis using Retool's native Redis connector. Enter your host, port, password, and TLS settings, then run Redis commands — GET, SET, KEYS, TTL, DEL, HGETALL — directly from Retool's query editor. Build cache monitoring dashboards that show key patterns, inspect values, check TTLs, and manage session data without dropping into a terminal or installing redis-cli.
| Fact | Value |
|---|---|
| Tool | Redis |
| Category | Database |
| Method | Retool Native Resource |
| Difficulty | Intermediate |
| Time required | 15 minutes |
| Last updated | April 2026 |
Build a Redis Cache Monitor and Key Inspector in Retool
Redis is the backbone of most high-performance web applications — handling session storage, API response caching, rate limiting counters, real-time leaderboards, and pub/sub messaging. Despite its central role, monitoring and managing Redis data typically requires SSH access and redis-cli commands, creating a bottleneck for operations teams who need visibility without terminal access. Retool's native Redis connector solves this by putting a visual interface on top of Redis commands.
A Redis Retool app lets operations teams search keys by pattern, inspect values across all Redis data types (strings, hashes, lists, sets, sorted sets), check TTL expirations, and delete or update keys — all from a browser. This is particularly valuable for debugging cache poisoning issues, inspecting session data for a specific user, or monitoring whether background jobs are populating expected keys on schedule.
Unlike relational database integrations where queries return neat tabular data, Redis responses vary by command type: a GET returns a single string, HGETALL returns a field-value object, LRANGE returns an array, and SMEMBERS returns a set. Retool's JavaScript transformer layer is essential for normalizing these varied response formats into something your Table and Text components can display consistently.
Integration method
Retool includes a native Redis connector that handles TCP connection management, TLS encryption, and authentication. You configure host, port, password, TLS, and database number in the Resources tab. Queries then specify the Redis command and its arguments directly — Retool executes the command on the Redis server and returns the result. All connections are proxied server-side, keeping Redis ports off the public internet.
Prerequisites
- A running Redis instance (Redis Cloud, ElastiCache, Upstash, Redis Enterprise, or self-hosted)
- The Redis host, port (default 6379), and password (or AUTH string) for your instance
- Network access from Retool's servers to your Redis port — either through a firewall rule, SSH tunnel, or self-hosted Retool deployment
- For Retool Cloud: Retool's IP ranges whitelisted in your Redis Cloud, ElastiCache, or Upstash firewall settings
- Knowledge of the Redis key naming conventions used in your application (e.g., key prefixes and patterns)
Step-by-step guide
Configure network access for Redis
Redis is typically deployed in a private network and should not be exposed directly to the internet. Before creating the Retool resource, ensure Retool's servers can reach your Redis port. For Redis Cloud: log into your Redis Cloud console, navigate to your database's Configuration settings, and add Retool's IP ranges to the allowed CIDR list. For AWS ElastiCache: modify the security group associated with your ElastiCache cluster to add an inbound rule for port 6379 from Retool's IP ranges (35.90.103.132/30 and 44.208.168.68/30 for US West). For Upstash: Upstash Redis allows connections from any IP by default with TLS and token-based authentication, so no IP whitelisting is needed — just enable TLS in your Retool resource. For self-hosted Redis behind a corporate firewall: use SSH tunneling through a bastion host (configured in the Retool resource settings) rather than opening the Redis port to the internet. For self-hosted Retool in the same VPC as Redis: use the private IP address or hostname directly — no firewall changes needed.
Pro tip: Never expose Redis port 6379 to the public internet without authentication and TLS. Redis is a common attack vector when misconfigured — use SSH tunneling or private network access.
Expected result: Retool's servers can reach your Redis instance on the configured port. A connectivity test (if available in your Redis provider's console) confirms the connection works from Retool's IP ranges.
Create the Redis resource in Retool
In Retool, go to the Resources tab and click '+ Create new resource'. Select 'Redis' from the connector list. On the configuration screen, fill in: Name — something descriptive like 'Redis Cache (Production)' or 'Redis Session Store'. Host — the hostname or IP of your Redis instance. For ElastiCache, this is the Primary Endpoint (e.g., my-cluster.xxxxx.use1.cache.amazonaws.com). For Redis Cloud, use the provided endpoint. For Upstash, copy the endpoint from your Upstash database dashboard. Port — the Redis port, defaulting to 6379. Upstash Redis uses port 6379 for standard connections and 6380 for TLS connections. Password — the Redis AUTH password. For ElastiCache without AUTH enabled, leave this blank. For Redis Cloud and Upstash, use the password shown in your database's security settings. Database index — Redis supports 16 logical databases (0-15) by default. Enter 0 unless your application uses a specific database number. Toggle 'Use TLS' on for any cloud-hosted Redis instance (Redis Cloud, Upstash, ElastiCache with in-transit encryption). Click 'Test connection' — a successful connection shows the Redis server version. Click Save.
Pro tip: If connecting to an ElastiCache cluster in Cluster Mode, note that Retool's Redis connector connects to a single node endpoint. For Cluster Mode, target a specific node's endpoint or use the Configuration Endpoint with cluster routing disabled for simple use cases.
Expected result: The Redis resource is saved and shows 'Connected' status with the Redis server version (e.g., Redis 7.0.12) displayed in the test result.
Run basic Redis commands in the query editor
Open your Retool app and create a new query in the Code panel. Select your Redis resource. The Redis query editor shows a Command field and an Arguments section. In the Command field, type the Redis command in uppercase — GET, SET, KEYS, DEL, TTL, TYPE, EXPIRE, HGETALL, etc. In the Arguments section, add each argument as a separate field. For a GET command: Command = GET, Argument 1 = the key name or a dynamic expression like session:{{ userIdInput.value }}. For a KEYS command: Command = KEYS, Argument 1 = a glob pattern like product:* or *. For HGETALL: Command = HGETALL, Argument 1 = the hash key name. Click Run to execute. The response appears in the query editor's result panel. For KEYS with a wildcard pattern, the result is an array of matching key names. For GET, it is a string value or null. For HGETALL, it is an object with field-value pairs. Create multiple queries for the different Redis operations your app needs — a common pattern is a scanKeys query, a getValue query, and a getTTL query, all referencing the same selected key from a table.
1// Redis query configuration examples2// Set Command and Arguments in the query editor UI34// --- GET a single key ---5// Command: GET6// Argument 1: {{ keyInput.value }}78// --- KEYS by pattern ---9// Command: KEYS10// Argument 1: {{ patternInput.value || 'session:*' }}1112// --- HGETALL a hash key ---13// Command: HGETALL14// Argument 1: {{ table1.selectedRow.key }}1516// --- TTL of a key ---17// Command: TTL18// Argument 1: {{ table1.selectedRow.key }}1920// --- EXPIRE to reset TTL ---21// Command: EXPIRE22// Argument 1: {{ table1.selectedRow.key }}23// Argument 2: 3600Pro tip: Avoid running KEYS in production Redis instances with millions of keys — it blocks the server while scanning. Use SCAN with COUNT and MATCH parameters instead for pattern-based key lookups on large keyspaces.
Expected result: Each query executes and returns the expected Redis response — a string for GET, an array for KEYS/LRANGE, an object for HGETALL, and an integer for TTL.
Use SCAN for safe key iteration and build a key browser
The KEYS command returns all matching keys in a single blocking call — on Redis instances with large keyspaces, this can cause latency spikes. The safer approach is SCAN, which iterates keys in cursor-based batches. In Retool, use a JavaScript query to implement a SCAN loop that collects keys matching your pattern. Create a JS query in the Code panel (select resource type as 'JavaScript' rather than Redis), then use utils.executeQuery() to call your Redis resource's SCAN command iteratively. Each SCAN call returns [nextCursor, [keys]] — continue iterating until the cursor returns '0'. After collecting all matching keys, build a second query to fetch metadata (TYPE and TTL) for each key, either by running TYPE and TTL individually or batching with a Pipeline query. Display the collected keys in a Table component with key, type, and TTL columns. Add a search TextInput that filters the table client-side using the Table's built-in search, and a Pattern button that re-runs the SCAN with a new pattern. For the TTL column, format the integer (seconds) as a human-readable string using a transformer.
1// JavaScript query to SCAN all keys matching a pattern2// Run this as a JavaScript query type (not Redis resource query)3const pattern = patternInput.value || '*';4const maxKeys = 500; // safety limit5const allKeys = [];6let cursor = '0';78do {9 const result = await utils.executeQuery('scanRedis', {10 command: 'SCAN',11 args: [cursor, 'MATCH', pattern, 'COUNT', '100']12 });13 // SCAN returns [nextCursor, [keyNames]]14 cursor = result[0];15 allKeys.push(...result[1]);16} while (cursor !== '0' && allKeys.length < maxKeys);1718// Fetch TTL for each key (batched to avoid overloading)19const keyData = await Promise.all(20 allKeys.map(async (key) => {21 const [ttl, type] = await Promise.all([22 utils.executeQuery('getTTL', { args: [key] }),23 utils.executeQuery('getType', { args: [key] })24 ]);25 return {26 key,27 type,28 ttl: ttl === -1 ? 'No expiry' : ttl === -2 ? 'Expired' : `${ttl}s`29 };30 })31);3233return keyData;Pro tip: Limit your SCAN results to a safe maximum (e.g., 500 keys) in the JavaScript loop to prevent Retool from trying to render thousands of rows in a single Table component load.
Expected result: The JavaScript query returns an array of key objects with name, type, and TTL. The Table component displays these with sortable columns, and clicking a row loads the key's value in a detail panel.
Build a key detail panel and value editor
When a user clicks a key in the browser table, display its value in a detail panel. The value display depends on the key type — strings show in a Text component, hashes show in a secondary Table, lists and sets show as item arrays. Use a Container component to hold the detail panel. Add a conditional component that renders different UI based on the selected row's type field. For string values: bind a Text component to {{ getValue.data }}. For hash values: bind a secondary Table to {{ formatHash.data }} where a transformer converts HGETALL's { field: value } object into [{ field: 'name', value: 'example' }, ...] row format. For list values: bind a Table to {{ getLRange.data }} with a single value column. Add an Edit section below: a TextArea pre-populated with the current value and a Set TTL input (number field defaulting to the current TTL). Wire a Save button to a SET command query for string keys (Command: SET, Arguments: key, new value) or HSET for hash fields. Wire a Delete Key button to a DEL command query with a confirmation modal. For complex Redis data management involving Lua scripts, Streams, or cluster-mode Redis, RapidDev's team can help architect and build your Retool solution.
1// Transformer: convert HGETALL response object to array of rows2// HGETALL returns: { "field1": "value1", "field2": "value2" }3// Transform to: [{ field: "field1", value: "value1" }, ...]4const hashData = data; // result of HGETALL query5if (!hashData || typeof hashData !== 'object') return [];67return Object.entries(hashData).map(([field, value]) => ({8 field,9 value: String(value),10 valueLength: String(value).length11}));Pro tip: Use Retool's Text component with 'Monospace' font for displaying Redis string values that may contain JSON — the fixed-width font makes structured data easier to read.
Expected result: Clicking a key in the browser table loads its value in the detail panel. String keys show their value in a text area, hash keys show a field-value table, and list keys show an ordered item list. TTL and type are displayed prominently.
Common use cases
Build a session store inspector
Your application stores user sessions in Redis with keys like session:{userId}. When users report being unexpectedly logged out, support engineers need to inspect their session key — does it exist? What is its TTL? Does the session data look correct? The Retool app takes a user ID input, runs GET or HGETALL against the session key, and displays the result alongside the TTL in seconds, letting support resolve the issue without needing Redis CLI access.
Build a session inspector tool. Add a TextInput for user ID. When submitted, run HGETALL against the key 'session:{userId}' and display the hash fields and values in a Table. Show the TTL from a separate TTL query. Add a 'Extend TTL' button that runs EXPIRE to reset it to 3600 seconds.
Copy this prompt to try it in Retool
Create a cache key browser and bulk invalidator
After a code deployment, you need to clear specific cache keys without flushing the entire Redis database. The Retool app lets engineers enter a key pattern (e.g., product:*), runs SCAN with that pattern to find matching keys, displays them in a Table with their types and TTLs, and provides a bulk delete button that runs DEL on selected keys. This is safer than FLUSHDB and faster than deleting keys one by one in redis-cli.
Build a cache key browser. Add a pattern input and a Scan button that runs SCAN to find matching keys. Display results in a Table with columns for key name, type (from TYPE command), and TTL. Add checkboxes for selection and a Delete Selected button that runs DEL on the selected keys after a confirmation modal.
Copy this prompt to try it in Retool
Monitor real-time counters and rate limit data
Your API uses Redis counters for rate limiting with keys like ratelimit:{apiKey}:{window}. The Retool dashboard lets the ops team search for a specific API key's current request count, see when the window expires, and manually reset the counter if a legitimate user has been incorrectly throttled. An auto-refreshing Table shows the top rate-limited keys across all active windows.
Build a rate limit monitor. Add a TextInput to search by API key. Show a Table with the current count (GET), TTL, and the calculated requests-per-minute. Add a Reset button that runs DEL on the selected key. Enable 30-second auto-refresh on the Table.
Copy this prompt to try it in Retool
Troubleshooting
Connection test fails with 'ECONNREFUSED' or 'Connection timed out'
Cause: Retool cannot reach the Redis port. Either the host or port is incorrect, the firewall is blocking Retool's IP ranges, or the Redis instance is not running.
Solution: Verify the Redis host and port are correct. Check your Redis provider's firewall or security group settings and ensure Retool's IP ranges are in the allow list. For Upstash, verify you are using the correct endpoint — Upstash provides separate REST API and Redis protocol endpoints. Test connectivity from a machine on your network using redis-cli -h hostname -p 6379 -a password PING.
Query returns WRONGTYPE error when running a command
Cause: You are running a command against a key that holds a different data type. For example, running GET on a hash key, or LRANGE on a string key. Redis is strictly typed — each key can only hold one data type.
Solution: Always run a TYPE command on a key before running data-retrieval commands. In your key browser, display the type column prominently so users know which command to use. Add a check in your detail panel: if selectedRow.type === 'hash', show HGETALL; if 'list', show LRANGE; if 'string', show GET.
KEYS or SCAN returns empty array even though keys exist
Cause: The key pattern uses the wrong wildcard syntax, or the queries are targeting the wrong Redis database number. Redis uses glob-style patterns: * matches any string, ? matches one character, [xyz] matches a character class.
Solution: Test the pattern in redis-cli first: KEYS 'session:*'. Verify the database number in your Retool resource matches the database where your application stores keys — if the app uses DB 1 and Retool is connected to DB 0, you will see an empty keyspace. Update the database index in the resource settings.
Authentication fails with NOAUTH or WRONGPASS error
Cause: The Redis instance requires authentication but the password in the Retool resource is empty, incorrect, or uses ACL-based authentication (username + password) rather than legacy password-only AUTH.
Solution: For Redis 6+ with ACL enabled, you may need both a username and password. Some Redis providers (Upstash, Redis Enterprise) use ACL-style credentials. Check if your Redis instance requires a username by consulting the provider documentation. Retool's Redis connector has separate fields for password and some versions support ACL username — verify the credential format your Redis instance expects.
Best practices
- Connect Retool to a Redis replica node (read replica or replica of a primary) for monitoring and read-only inspection dashboards — this prevents your Retool queries from competing with application traffic on the primary node.
- Never run KEYS command in production Redis with large keyspaces — use SCAN with MATCH and COUNT instead to iterate keys without blocking the server.
- Add a confirmation modal (Popconfirm component) before any DEL, FLUSHDB, or SET command that modifies production Redis data — cache corruption is hard to reverse and can cascade to application failures.
- Use Retool's query caching feature for TTL and key statistics queries that do not need to be real-time — cache results for 30-60 seconds to reduce the number of Redis commands Retool generates.
- Create a read-only Redis user using ACL commands (ACL SETUSER retool-readonly +get +hgetall +lrange +smembers +ttl +type +scan ~* nocommands) and use those credentials in read-only Retool dashboards, reserving write permissions for operational tools.
- For Retool apps that display Redis values containing JSON strings, add a transformer that calls JSON.parse() and re-stringifies with indentation so the value displays as formatted JSON rather than a compact string.
- Implement key TTL monitoring — store the numeric TTL and alert (via a colored badge in the Table) on keys that are either about to expire (TTL < 60 seconds) or have no expiry set (TTL = -1) when they should have one.
Alternatives
PostgreSQL is the right choice when you need persistent relational data with SQL queries and transactions, rather than ephemeral in-memory caching and key-value lookups.
DynamoDB is a better fit when you need a fully managed NoSQL database with persistent storage and flexible key-value or document data models rather than Redis's in-memory caching.
MongoDB suits teams that need a persistent document database with rich query capabilities, rather than Redis's ephemeral key-value store optimized for speed.
Frequently asked questions
Which Redis commands can I run from Retool?
Retool's Redis connector supports any Redis command that returns a response — GET, SET, DEL, KEYS, SCAN, TTL, EXPIRE, TYPE, HGET, HGETALL, HSET, LRANGE, LPUSH, RPUSH, SMEMBERS, SADD, ZADD, ZRANGE, and more. Commands that subscribe to channels (SUBSCRIBE, PSUBSCRIBE) are not supported since they require a persistent connection. FLUSHDB and FLUSHALL work but should be used with extreme caution in production environments.
Can Retool connect to Redis Cluster mode?
Retool's native Redis connector connects to a single endpoint. For Redis Cluster mode, point Retool at a specific primary node's direct endpoint rather than the cluster's routing endpoint. For ElastiCache Cluster Mode Disabled, use the Primary Endpoint. For Cluster Mode Enabled, you can target individual shards but cross-slot operations will fail. Upstash Redis works in single-instance mode even in its serverless offering and connects normally.
How do I inspect a Redis key's value when I don't know its data type?
Create two queries: one running the TYPE command to get the key's data type (string, hash, list, set, or zset), and another running the appropriate retrieval command based on the type result. In your Retool app, use a conditional display (show different component types based on the type query result) or a Text component that shows the raw output. A transformer can format the response appropriately for each type.
Is it safe to connect Retool to a production Redis instance?
Yes, with proper precautions. Use a read-only ACL user for monitoring dashboards to prevent accidental writes. Connect to a replica rather than the primary for read-heavy monitoring. Add confirmation modals before any destructive commands. Avoid KEYS and FLUSHDB in production. Use Retool's audit log (Business plan) to track which users ran which Redis commands and when.
Can I use Retool to monitor Redis memory usage and server statistics?
Yes. The INFO command returns a comprehensive set of Redis server statistics including used_memory, connected_clients, keyspace_hits, keyspace_misses, and replication status. Run INFO all as a Redis query in Retool and use a transformer to parse the response string into a key-value object for display. The DBSIZE command returns the number of keys in the current database.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation