Clustered configuration scenario
A cluster is a group of devices, servers, or other resources that act as a single system to promote availability and in some cases, may execute load balancing and parallel processing.
A clustered setup for Martini involves having multiple servers clustered together in a group so that Martini's workload can shift from server to server to ensure maximum uptime and reliability. In a clustered environment, instances are grouped into nodes where they may work together to maintain the desired state of a service. This may be achieved by deploying Martini in a Docker swarm.
cluster.* properties when deploying Martini behind another application
When another application is configured to run in front of your Martini instance, like NGINX or Docker,
it is highly recommended to set the
cluster.instance-ssl-port application properties.
These properties define Martini's reachable IP address, HTTP port, and SSL port respectively.
cluster.instance-ip-address setting, the current machine IP address is used instead;
which may not be exposed publicly and thus, can cause problems when executing service registry related operations.
The same is true for both
which default to the values of the server HTTP and SSL port.
If you do not wish to use SSL in your cluster, set the property to
-1, or do not set it at all.
For example, when a Martini node within a Docker swarm environment becomes unavailable, the running Docker service will be passed to another node and you will be able to continue serving requests.
Another way to effectively setup a successful clustered environment for Martini is to configure the different applications embedded in your instance to support your cluster configuration.
These configurations are useful when using multiple Martini instances in a clustered environment in a way that they can provide a centralized source and destination of data. These may be used for instances, independent or clustered alike:
Running Martini with a cluster manager
You may want to configure a cluster manager with your Martini cluster. The manager can be used to assist with leader election1 (for use with non-replicated endpoints), and service discovery. Configuring Martini to work with a cluster manager is very easy. In most cases it's just a matter of setting a few application properties. The next few pages describe how to configure Martini to work with the following:
Cluster management properties are not in the
Unlike many other commented-out properties in the
application.properties file that
Martini ships with, properties related to cluster management are not included, and have to be added manually.