Configuring Replicas for Flex Gateway in Connected Mode
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.
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:
sudo systemctl start flex-gateway
Verify that the Flex Gateway service is running successfully:
systemctl list-units flex-gateway*
If flex-gateway.service
has a status of active
, Flex Gateway is successfully running.
UNIT LOAD ACTIVE SUB DESCRIPTION
flex-gateway.service loaded active running Application
Now if you check in Runtime Manager after clicking Flex Gateway in the left navigation, your Flex Gateway will have an additional replica listed. You may need to refresh the page.
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.
Start Command
Run the following start command in the same directory where you ran the registration command:
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 Flex Replica by including the following: -e FLEX_NAME=<name-for-flex-replica> \ .
|
Now if you check in Runtime Manager after clicking Flex Gateway in the left navigation, your Flex Gateway will have an additional replica listed. You may need to refresh the page.