---
schema_version: "1"
id: dc19e19af74cdc0db329e6c3c813442cab1adf59d36e295024d98647b1fb18d9
title: Configuring Distributed 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/latest/conn-distributed-shared-storage-config.md
canonical_url: https://docs.mulesoft.com/gateway/latest/conn-distributed-shared-storage-config
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 509b2b77c52c3326eebff407885a30f90ec64e5be5b7e15e20e647a270715305
description: MuleSoft Documentation Site
release: "1.14"
latest: true
---
---
product: Omni Gateway
version: 1.14
is-latest-version: true
---

# Configuring Distributed Shared Storage for Omni Gateway in Connected Mode

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

Enable distributed shared storage for distributed caching, gateway configuration caching (Connected
Mode), and rate limiting policies.

Distributed shared storage enables multiple gateway replicas to share state across a distributed
deployment.

Distributed shared storage is persistent, but data is lost when all replicas go down (scaled to zero
replicas). For persistent shared storage,
[configure Redis shared storage](https://docs.mulesoft.com/gateway/latest/conn-shared-storage-config).

You configure distributed shared storage via a storage YAML file.

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

<table><colgroup><col> <col> <col></colgroup><tbody><tr><td><div><div><p><span><a href="#linux"><img src="https://docs.mulesoft.com/gateway/latest/_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/latest/_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/latest/_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/latest/install)

2.  [Register and Run Omni Gateway](https://docs.mulesoft.com/gateway/latest/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 distributed shared 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 distributed shared storage:

    ```yaml
    apiVersion: gateway.mulesoft.com/v1alpha1
    kind: Configuration
    metadata:
      name: api-shared-storage
    spec:
      sharedStorage:
        objectStore:
          url: distributed://0.0.0.0:30001?join=flex.hostname.com:30001
    ```

> [!NOTE] You can specify multiple host names in the `join` parameter by separating them with
> commas. For example:
> `distributed://0.0.0.0:30001?join=node1.example.com:30001,node2.example.com:30001,192.168.1.10:30001`.
> The hostname must resolve to the IPs of the Omni Gateway replicas. Firewall rules must allow Omni
> Gateway replicas to create connections between each other on port 30001.

## 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 distributed shared storage:

    ```yaml
    apiVersion: gateway.mulesoft.com/v1alpha1
    kind: Configuration
    metadata:
      name: api-shared-storage
    spec:
      sharedStorage:
        objectStore:
          url: distributed://0.0.0.0:30001?join=flex.hostname.com:30001
    ```

> [!NOTE] You can specify multiple host names in the `join` parameter by separating them with
> commas. For example:
> `distributed://0.0.0.0:30001?join=node1.example.com:30001,node2.example.com:30001,192.168.1.10:30001`.
> The hostname must resolve to the IPs of the Omni Gateway replicas. Firewall rules must allow Omni
> Gateway replicas to create connections between each other on port 30001.

## 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 distributed shared storage:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: Configuration
metadata:
  name: api-shared-storage
spec:
  sharedStorage:
    objectStore:
      url: distributed://0.0.0.0:30001?join=flex.hostname.com:30001
```

> [!NOTE] You can specify multiple host names in the `join` parameter by separating them with
> commas. For example:
> `distributed://0.0.0.0:30001?join=node1.example.com:30001,node2.example.com:30001,192.168.1.10:30001`.
> The hostname must resolve to the IPs of the Omni Gateway replicas. Firewall rules must allow Omni
> Gateway replicas to create connections between each other on port 30001.

## See Also

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

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