> For the complete documentation index, see [llms.txt](https://docs.carto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carto.com/carto-self-hosted/carto-self-hosted-legacy/guides/configure-an-external-in-memory-cache.md).

# Configure an external in-memory cache

{% hint style="danger" %}
**This documentation is for the CARTO Self-Hosted Legacy Version**. Use only if you've installed this specific version. Explore our latest documentation for updated features.
{% endhint %}

CARTO Self-Hosted requires Redis (version 6 or above) to work. This Redis instance does not need persistence, as it is used solely as a cache.

Both [**Single VM deployment**](/carto-self-hosted/carto-self-hosted-legacy/key-concepts/deployment-requirements.md#single-vm-deployment-docker-compose) and [**Orchestrated container deployment**](/carto-self-hosted/carto-self-hosted-legacy/key-concepts/deployment-requirements.md#orchestrated-deployment-kubernetes) come already with an internal Redis deployment, but they lack any backups, autoscaling, or monitoring. Cloud vendors already offer Redis deployments at scale as a service:

* [Google Memorystore for Redis](https://cloud.google.com/memorystore).
* [Amazon ElastiCache for Redis](https://aws.amazon.com/elasticache/redis/).
* [Azure Cache for Redis](https://azure.microsoft.com/en-us/products/cache).

In this section, you will see how to configure the Self-hosted to use an external Redis provided by your cloud vendor.

## Single VM deployments (Docker Compose)

### Configuration

1. Comment the local Redis configuration:

   ```
   # Configuration for using a local redis, instead of a external one (comment when external redis)
   - LOCAL_REDIS_SCALE=1
   - REDIS_HOST=redis
   - REDIS_PORT=6379
   - REDIS_TLS_ENABLED=false
   + # LOCAL_REDIS_SCALE=1
   + # REDIS_HOST=redis
   + # REDIS_PORT=6379
   + # REDIS_TLS_ENABLED=false
   ```
2. Uncomment the external Redis configuration:

   ```
   # Your custom configuration for a external redis (comment when local redis)
   - # LOCAL_REDIS_SCALE=0
   - # REDIS_HOST=<FILL_ME>
   - # REDIS_PORT=<FILL_ME>
   - # REDIS_PASSWORD=<FILL_ME>
   - # REDIS_TLS_ENABLED=true
   # Only applies if Redis TLS certificate it's self signed, read the documentation
   # REDIS_TLS_CA=<FILL_ME>
   + LOCAL_REDIS_SCALE=0
   + REDIS_HOST=<FILL_ME>
   + REDIS_PORT=<FILL_ME>
   + REDIS_PASSWORD=<FILL_ME>
   + REDIS_TLS_ENABLED=true
   ```
3. Replace the `<FILL_ME>` placeholders with the right values.

### Configure TLS

By default, CARTO will try to connect to your Redis without TLS, in case you want to connect via TLS, you can configure it via `REDIS_TLS_ENABLED` env vars in the <mark style="color:orange;">customer.env</mark> file.

```
REDIS_TLS_ENABLED=true
```

> ⚠️ In case you are connecting to a Redis instance where the TLS certificate is self signed or from a custom CA you will need to configure the `REDIS_TLS_CA` variable

1. Copy your CA `.crt` file inside the `certs` folder. Rename the CA `.crt` file to `redis-tls-ca.crt`.
2. Uncomment the `REDIS_TLS_CA` env var in the <mark style="color:orange;">customer.env</mark> file.

   ```
   # Only applies if Redis TLS certificate it's selfsigned, read the documentation
   - # REDIS_TLS_CA=/usr/src/certs/redis-tls-ca.crt
   + REDIS_TLS_CA=/usr/src/certs/redis-tls-ca.crt
   ```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.carto.com/carto-self-hosted/carto-self-hosted-legacy/guides/configure-an-external-in-memory-cache.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
