Skip to main content

Connect to Redis

Redis is an open source, in-memory data store commonly used as a cache, message broker, and key-value database. You can create a Redis resource to connect to your Redis server and build apps and automations that read and write data.

What you can do with Redis in Retool​

After you create a Redis resource in Retool, you can:

  • Read and display keys and values from your Redis database.
  • Write and update data in your Redis database.
  • Build admin panels and dashboards backed by cached or session data.
  • Automate data workflows against your Redis server.

Before you begin​

To connect Redis to Retool, you need the following:

  • Redis server: A running Redis server.
  • Host and port: The hostname or IP address and port of your server. Redis listens on port 6379 by default.
  • Credentials: A password for your Redis server. If your server uses Redis ACLs, you also need a username.
  • Network access: Your Redis server must be reachable from your Retool instance.
  • Retool permissions: Ability to create and manage resources in your organization.

Create a Redis resource​

Follow these steps to create a Redis resource in your Retool organization.

Create a new resource​

In your Retool organization, navigate to Resources in the main navigation and click Create new → Resource. Search for "Redis" and click the Redis tile to begin configuration.

Best practice

Use folders to organize your resources by team, environment, or resource type. This helps keep your resource list manageable as your organization grows.

Configure general settings​

Specify a name and description for the resource that indicates which Redis server it connects to. The description provides more context to users about how to use the resource.

Example nameExample description
Session cacheRedis server that stores user session data.
Rate limits (read only)Read-only access to the Redis server that tracks API rate limits.

Configure resource credentials​

Configure the connection settings for your Redis resource.

Redis resource configuration form.

Host​

The hostname or IP address of your Redis server.

Example
redis.example.com

Port​

The port your Redis server listens on. Defaults to 6379.

Database number​

The number of the Redis database to connect to. Redis servers have numbered databases, and Redis uses database 0 by default.

Username​

The username for your Redis server. Username is only required if your server uses Redis Access Control Lists (ACLs). Refer to the Redis security documentation for more about ACLs.

Password​

The password for your Redis server.

If you want to connect to Redis without a password, you must disable protected mode in Redis. Refer to the Redis security documentation for details.

SSL/TLS​

Enable Use SSL/TLS to encrypt the connection between Retool and your Redis server. Refer to the SSL/TLS documentation for more about working with certificates. When you enable SSL/TLS, the following fields appear:

FieldDescription
CA CertificateThe certificate authority (CA) certificate used to verify your server's certificate.
Client KeyThe client private key, if your server requires client certificate authentication.
Client CertificateThe client certificate, if your server requires client certificate authentication.
Verification modeChoose Full verification, Verify CA Certificate, or Skip CA Certificate verification. Skipping verification leaves your connection open to attack, so use it only for testing.

Configure advanced options​

Configure optional settings available under the Advanced options section of the resource configuration form.

SSH tunnel​

If your Redis server is not publicly accessible, select Enable SSH tunnel to connect through a bastion host. Provide the Bastion host and Bastion port. Refer to the SSH tunnel documentation for details.

Outbound region​

If your organization uses outbound regions, select the region that should be used for requests to Redis. This controls which geographic region your requests originate from.

Test the connection​

Click Test connection to verify Retool can connect to your Redis server. If the test fails, check the following:

  • Network access: Ensure your server accepts connections from Retool's IP addresses (cloud) or your Retool instance's network (self-hosted).
  • Host and port: Confirm the hostname resolves and that the port matches the port your server listens on.
  • Authentication: If you see NOAUTH Authentication required, Retool reached your server but couldn't authenticate because a password is required. Enter the password, and a username if your server uses ACLs.
  • SSL/TLS: If your server requires encryption, confirm Use SSL/TLS is enabled and the certificates are valid.
Use Debug Tools for detailed connection information

After testing the connection, click View in console to open the Debug Tools console. The console displays the test query executed, its response, execution time, and error details if the test fails. This information is helpful for troubleshooting connection issues.

Save the resource​

Click Create resource to save your Redis resource. You can now use it in queries across your Retool apps and automations.

Interact with Redis data​

Once you've created a Redis resource, you can interact with Redis data using Retool.

Switch to the new app builder

Retool recommends using the new app builder so you can use natural language to build React-based apps using AI.

  • To use Redis data in the app builder, reference the resource in the prompt with @, such as @Session cache. Refer to the data and functions documentation to learn more.
  • For classic apps, workflows, and agents, refer to the resource query documentation to learn how to write a resource query.

Best practices​

Follow these best practices to maintain the security of your Redis resource.

  • Require a password: Run your Redis server with a password rather than disabling protected mode, so only authenticated clients can read or modify data.
  • Apply least privilege: If your server supports Redis ACLs, create a dedicated user for Retool with access to only the commands and keys it needs. Use a read-only user for resources that only read data.
  • Enable SSL/TLS: Encrypt connections to your server, and use Full verification so Retool validates the server certificate.
  • Use an SSH tunnel for private servers: Keep your Redis server off the public internet and connect through an SSH tunnel.
  • Use resource environments: Configure multiple resource environments to maintain separate servers or credentials for production, staging, and development.