Contact Us 1-800-596-4880

Configuring Distributed Shared Storage for Omni Gateway in Local Mode

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 isn’t persistent and data is lost when all replicas go down (scaled to zero replicas). For persistent shared storage, configure Redis shared storage.

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.

20%

25%

20%

Before You Begin

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

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:

    sudo mkdir /usr/local/share/mulesoft/flex-gateway/conf.d/storage
  2. Create a YAML configuration file in the storage folder:

    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:

    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:

    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
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

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:

    docker run --rm \
    -v "$(pwd)":/usr/local/share/mulesoft/flex-gateway/conf.d \
    -p 8080:8080 \
    mulesoft/flex-gateway
    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:

    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
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:

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
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.