API Gateway Container Cluster Configuration
You can combine API Gateway Docker containers to form a cluster.
To configure an API Gateway Docker container cluster:
1. Configure load balancer on the Docker host.
2. Create the basic API Gateway Docker image.
3. Create cluster API Gateway Docker image and enhance it with the cluster configuration in one of the following ways:
Clustered all-in-one containers that consist of
API Gateway, external Elasticsearch, and external Kibana.
Clustered
API Gateway containers with externalized Elasticsearch and external Kibana containers.
Clustered all-in-one containers that consist of API Gateway, external Kibana, and external Elasticsearch
Although API Gateway clusters with externalized Elasticsearch is the preferred approach, you can also cluster API Gateway all-in-one containers. The clustering can be configured using Apache Ignite.
Note:
Having external Kibana is an optional variation.
Peer-to-peer clustering using Apache Ignite
The following diagram depicts peer-to-peer clustering using Apache Ignite.
The all-in-one containers hold API Gateway, external Kibana, and external Elasticsearch. The clustering is done using Apache Ignite and the cluster capabilities of the external Elasticsearch instances.
Inject the required settings for the cluster configuration during Docker run through an environment file.
A sample environment file when clustering is done through Apache Ignite looks as follows.
apigw_cluster_aware=true
apigw_cluster_name=APIGatewayCluster
apigw_cluster_ignite_hostnames=apigw1,apigw2,apigw3
apigw_cluster_ignite_discoveryPort=10100
apigw_cluster_ignite_communicationPort=10400
Clustered API Gateway containers with externalized Elasticsearch and external Kibana containers
The API Gateway cluster can be peer-to-peer, and it communicates to a cluster of external Elasticsearch containers through a load balancer. The external Elasticsearch load balancer also provides the external Elasticsearch endpoint for the external Kibana containers.
Note:
The externalized Kibana is optional. You can still run external Kibana within the API Gateway container.
Peer-to-peer clustering using Apache Ignite
To cluster API Gateway with external containers for external Elasticsearch, external Kibana, and Apache Ignite, you can inject the settings into an API Gateway Docker image when starting, by providing an environment file. The environment file has to define the following environment variables.
apigw_cluster_aware=true
apigw_cluster_name=name
apigw_cluster_ignite_hostnames=comma-separated list of host names
apigw_cluster_ignite_discoveryPort=port
apigw_cluster_ignite_communicationPort=port
apigw_elasticsearch_hosts=host:port
apigw_elasticsearch_http_username=user
apigw_elasticsearch_http_password=password
apigw_kibana_dashboardInstance=instance
A sample assignment of environment variables looks as follows:
apigw_cluster_aware=true
apigw_cluster_name=APIGatewayCluster
apigw_cluster_ignite_hostnames=apigw1,apigw2,apigw3
apigw_cluster_ignite_discoveryPort=10100
apigw_cluster_ignite_communicationPort=10400
apigw_elasticsearch_hosts=testhost1:9200
apigw_elasticsearch_http_username=
apigw_elasticsearch_http_password=
apigw_kibana_dashboardInstance=http://testhost1:9405