---
schema_version: "1"
id: 19a3bb307268e92667030e9d0439640ec2e5103a7e70856364b1e36849265459
title: Configuring Redis Shared Storage for Omni Gateway in Connected Mode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.13/conn-shared-storage-config.md
canonical_url: https://docs.mulesoft.com/gateway/1.13/conn-shared-storage-config
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 886a4bfd236f69cf07dacfb4104ee83cdeb422465d9096d7e590fbfcb1f9322e
description: MuleSoft Documentation Site
release: "1.13"
latest: false
---
---
product: Omni Gateway
version: 1.13
---

# Configuring Redis Shared Storage for Omni Gateway in Connected Mode

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

> [!NOTE] Where possible, we changed noninclusive terms to align with our company value of Equality.
> We maintained certain terms to avoid any effect on customer implementations.

Enable [Redis](https://redis.io/) shared storage for distributed caching, gateway configuration
caching (Connected Mode), and rate limiting policies.

Configure Redis shared storage if persistent storage is required when all replicas go down (scaled
to zero replicas). If persistent shared storage isn’t required,
[configure distributed shared storage](https://docs.mulesoft.com/gateway/1.13/conn-distributed-shared-storage-config).

You configure shared storage via a storage YAML file.

The following steps demonstrate Redis-based storage support for Omni Gateway running in a Docker
container, as a Linux service, or as a Kubernetes cluster.

To configure Redis Sentinel or a TLS connection to your Redis shared storage, see:

- [Configure Redis Sentinel](#redis-sentinel)

- [Configure TLS for Redis-Based Shared Storage](#redis-tls)

<table><colgroup><col> <col> <col></colgroup><tbody><tr><td><div><div><p><span><a href="#linux"><img src="https://docs.mulesoft.com/gateway/1.13/_images/install-linux-logo.png" alt="20%" width="20%"></a></span></p></div></div></td><td><div><div><p><span><a href="#docker"><img src="https://docs.mulesoft.com/gateway/1.13/_images/install-docker-logo.png" alt="25%" width="25%"></a></span></p></div></div></td><td><div><div><p><span><a href="#kubernetes"><img src="https://docs.mulesoft.com/gateway/1.13/_images/install-kubernetes-logo.png" alt="20%" width="20%"></a></span></p></div></div></td></tr><tr><td><div><div><p><a href="#linux">Configure Shared Storage for Omni Gateway as a Linux service</a></p></div></div></td><td><div><div><p><a href="#docker">Configure Shared Storage for Omni Gateway in a Docker Container</a></p></div></div></td><td><div><div><p><a href="#kubernetes">Configure Shared Storage for Omni Gateway in a Kubernetes Cluster</a></p></div></div></td></tr></tbody></table>

## Before You Begin

Before configuring shared storage for Omni Gateway, complete the following tasks:

1.  [Download Omni Gateway](https://docs.mulesoft.com/gateway/1.13/install)

2.  [Register and Run Omni Gateway](https://docs.mulesoft.com/gateway/1.13/conn-reg-run)

## Configure Shared Storage for Omni Gateway as a Linux service

1.  Create a folder in the `/usr/local/share/mulesoft/flex-gateway/conf.d` directory and name it
    `storage`:

    ```ssh
    sudo mkdir /usr/local/share/mulesoft/flex-gateway/conf.d/storage
    ```

2.  Create a YAML configuration file in the `storage` folder:

    ```ssh
    sudo touch /usr/local/share/mulesoft/flex-gateway/conf.d/storage/shared-storage-config.yaml
    ```

3.  Update the file with your Redis storage configuration details. For example:

    ```ssh
    sudo vi /usr/local/share/mulesoft/flex-gateway/conf.d/storage/shared-storage-config.yaml
    ```

4.  Apply this configuration to all Omni Gateway replicas for them to share data. Sample
    configuration for adding Redis-based shared storage:

    ```yaml
    apiVersion: gateway.mulesoft.com/v1alpha1
    kind: Configuration
    metadata:
      name: shared-storage-redis
    spec:
      sharedStorage:
        redis:
          address: redis.e-commerce.svc:6379
          username: ecomm-user
          password: ecomm-pwd-123
          DB: 7
    ```

## Configure Shared Storage for Omni Gateway in a Docker Container

> [!NOTE] If you have already added a volume for a folder with your Omni Gateway configuration
> files, skip to the last step.

1.  Stop your Omni Gateway and any replicas.

2.  Create a folder named `app` in the directory with your Omni Gateway configuration files.

3.  Restart your Omni Gateway with an additional volume for the new `app` directory:

    ```ssh
    docker run --rm \
    -v "$(pwd)":/usr/local/share/mulesoft/flex-gateway/conf.d \
    -p 8080:8080 \
    mulesoft/flex-gateway
    ```

    > [!NOTE] Specify an optional name you want to assign to your Omni Replica by including the
    > following: `-e FLEX_NAME=<name-for-flex-replica> \`.

4.  Create and save a YAML configuration file in your `app` folder with your shared storage details.

5.  Apply this configuration to all Omni Gateway replicas for them to share data.

    Sample configuration for adding Redis-based shared storage:

    ```yaml
    apiVersion: gateway.mulesoft.com/v1alpha1
    kind: Configuration
    metadata:
      name: shared-storage-redis
    spec:
      sharedStorage:
        redis:
          address: redis.e-commerce.svc:6379
          username: ecomm-user
          password: ecomm-pwd-123
          DB: 7
    ```

## Configure Shared Storage for Omni Gateway in a Kubernetes Cluster

1.  Create a new resource using a YAML configuration file with your storage details.

2.  Apply this configuration to all Omni Gateway replicas for them to share data.

Sample configuration for adding Redis-based shared storage:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
  name: shared-storage-redis
spec:
  sharedStorage:
    redis:
      address: redis.e-commerce.svc:6379
      username: ecomm-user
      password: ecomm-pwd-123
      DB: 7
```

## Configure Redis Sentinel

Redis Sentinel provides high availability for Redis shared storage. For more information about Redis
Sentinel, refer to
[Redi Sentinel](https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel/).

Configure Redis Sentinel using the steps described in the previous sections.

Sample configuration for adding Redis Sentinel:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
  name: shared-storage
  namespace: test-ns
spec:
  sharedStorage:
    redis:
      username: "user"
      password: "pass"
      sentinel:
        addresses:
          - internal.redis.com:6379
        masterName: "name"
        password: "pass"
      db: 0
```

## Configure TLS for Redis-Based Shared Storage

Use TLS with Redis to ensure data security between Omni Gateway and the Redis instance. Configuring
TLS enables you to protect sensitive data, prevent unauthorized access, and maintain the reliability
of your services. Additionally, configuring TLS helps organizations meet compliance requirements and
build trust with users.

TLS works with both Redis and Redis Sentinel.

Configure TLS for Redis-based shared storage using the steps described in the previous sections.

Sample configuration for adding Redis-based shared storage with TLS:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
  name: shared-storage-redis
spec:
  sharedStorage:
    redis:
      address: internal.redis.com:6379
      tls:
        skipValidation: false
        minVersion: "1.1"
        maxVersion: "1.3"
        alpn:
          - h2
          - http/1.1
        ciphers:
          - TLS_AES_128_GCM_SHA256
          - TLS_AES_256_GCM_SHA384
          - TLS_CHACHA20_POLY1305_SHA256
          - TLS_RSA_WITH_3DES_EDE_CBC_SHA
          - TLS_RSA_WITH_AES_128_CBC_SHA
          - TLS_RSA_WITH_AES_256_CBC_SHA
          - TLS_RSA_WITH_AES_128_CBC_SHA256
          - TLS_RSA_WITH_AES_128_GCM_SHA256
          - TLS_RSA_WITH_AES_256_GCM_SHA384
          - TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
          - TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
          - TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
          - TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
          - TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
          - TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
          - TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
          - TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
          - TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
          - TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
        trustedCA: |
          -----BEGIN CERTIFICATE-----
          ...
          -----END CERTIFICATE-----

        certificate:
          keyPassphrase: "****"
          key: |
            -----BEGIN RSA PRIVATE KEY-----
            ...
            -----END RSA PRIVATE KEY-----

          crt: |
            -----BEGIN CERTIFICATE-----
            ...
            -----END CERTIFICATE-----
```

For information about configuration parameters, see the
[Declarative Configuration Reference (Shared Storage)](https://docs.mulesoft.com/gateway/1.13/local-configuration-reference-guide#shared-storage).

## See Also

- [Configuring Shared Storage for Omni Gateway in Local Mode](https://docs.mulesoft.com/gateway/1.13/local-shared-storage-config)

- [Declarative Configuration Reference Guide](https://docs.mulesoft.com/gateway/1.13/local-configuration-reference-guide#shared-storage)
