---
schema_version: "1"
id: a7d6a37684b8e9d91209bff756c3b2b6ae73d3aecdaf0d19774ae491fad5d523
title: Configuring Replicas for Flex Gateway in Local Mode
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.12/flex-local-rep-run.md
canonical_url: https://docs.mulesoft.com/gateway/1.12/flex-local-rep-run
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a5cdc7fa287b68fbebc40d61792582f9d2bc71d7a6a9f0d04185349ad32cec9b
description: MuleSoft Documentation Site
release: "1.12"
latest: false
---
---
product: Omni Gateway
version: 1.12
---

# Configuring Replicas for Flex Gateway in Local Mode

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

<table><colgroup><col> <col></colgroup><tbody><tr><td><div><div><p><span><a href="#add-a-flex-replica-as-a-linux-service"><img src="https://docs.mulesoft.com/gateway/1.12/_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.12/_images/install-docker-logo.png" alt="25%" width="25%"></a></span></p></div></div></td></tr><tr><td><div><div><p><a href="#add-a-flex-replica-as-a-linux-service">Add a Flex Replica as a Linux Service</a></p></div></div></td><td><div><div><p><a href="#docker">Add a Flex Replica in a Docker Container</a></p></div></div></td></tr></tbody></table>

## Flex Replicas

A Flex Replica is an instance of Flex Gateway. Setting up your gateway layer with multiple Flex
Gateway replicas enables the APIs deployed on Flex Gateway to serve more traffic.

When using Flex Gateway to manage APIs in production, configure more than one Flex Replica to avoid
a single point of failure. Running multiple Flex Replicas also increases performance if your API
service receives a significant amount of traffic.

## Before You Begin

Before getting started, ensure you have completed the following tasks:

- [Install a Flex Gateway](https://docs.mulesoft.com/gateway/1.12/flex-install)

- [Register and Run in Local Mode](https://docs.mulesoft.com/gateway/1.12/flex-local-reg-run)

## Add a Flex Replica as a Linux Service

Adding a Flex Replica as a Linux Service includes the following tasks:

- Copy and paste the registration file created during registration to your Linux machine or VM.

- Run the Flex Gateway start command.

### Copy the Registration File

Copy the `registration.yaml` file to the following location on your Linux machine or VM:

- `/usr/local/share/mulesoft/flex-gateway/conf.d`

### Start Commands

Start Flex Gateway with the following command:

```ssh
sudo systemctl start flex-gateway
```

Verify that the Flex Gateway service is running successfully:

```ssh
systemctl list-units flex-gateway*
```

If `flex-gateway.service` has a status of `active`, Flex Gateway is successfully running.

```text
  UNIT                              LOAD   ACTIVE SUB     DESCRIPTION
  flex-gateway.service              loaded active running Application
```

## Add a Flex Replica in a Docker Container

To add a Flex Replica in a Docker Container you must run the Flex Gateway start command using the
same `registration.yaml` file created during registration. If you are running the container locally,
you will also need to use a different port.

```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 Flex Replica by including the
> following: `-e FLEX_NAME=<name-for-flex-replica> \`.
