Welcome Guest! Log in


The Runtime features a native client mechanism that allows to define a cluster of load balanced Runtimes with failover management.

When connecting to the cluster, the system will automatically redirect to one of the defined Runtimes nodes.

The failover mechanism will handle automatically the situation where the node is not available.

Prerequisites:

  • Stambia DI Runtime S17.4.0 or higher

 

Configuration

All the cluster configuration is done in a file named client.xml that must be created under the <stambiaRuntime>/properties/ folder.

A file sample is available under the <stambiaRuntime>/properties/samples/client/ folder.

The content of this file looks like this:

<client connectionTimeout="3000">
    <connection name="cluster" retry="2" delay="1">
        
        <!-- Main Load Balanced 3 nodes -->    
        <runtime host="localhost" port="42000" priority="0" user="admin" uncryptedPassword="admin"/>
        <runtime host="localhost" port="43000" priority="0" />
        <runtime host="localhost" port="44000" priority="0" />
        
        <!-- Failover Load Balanced 3 nodes -->
        <runtime host="localhost" port="45000" priority="1" />
        <runtime host="localhost" port="46000" priority="1" />
        <runtime host="localhost" port="47000" priority="1" />
        
        <!-- The load balancing strategy. For the moment, only the 'random' strategy is supported-->
        <property name="loadBalancing.strategy" value="random"/> 
    </connection>
</client>

 

Important:

This a client system and it will not configure, start, or prepare automatically any Runtime.

This feature is used only to connect and load balance the request to one of the defined Runtime, that must be configured, prepared and started independently.

 

The connection node

The main connection node is used to define the cluster name and retry behavior.

The syntax is the following:

<connection name="cluster name" retry="number of retry" delay="retry delay">
</connection>

 

The following attributes are available:

Attribute Description
name Name of the Runtime cluster. This is important as this is the name that must be used to connect to the cluster.
retry When the cluster fails to connect to a Runtime (including the failover nodes), it will try again the amount of time specified in this attribute.
delay Time, in milliseconds, to wait between each retry.

 

The Runtime node

You can define as many "runtime" node as required, and the syntax is the following:

<runtime host="localhost" port="42000" priority="0" user="runtimeUser" password="encrypted password" uncryptedPassword="plain text password"/>

 

The following attributes are available:

Attribute Is Mandatory Description
host yes Hostname of the Runtime.
port yes Port of the Runtime.
priority yes Priority of the Runtime.
The cluster tries to connect first to one of the Runtime nodes with the highest priority (0 being the highest).
If it is not available, it will try to access to a node with a lower priority recursively.
user no User of the Runtime
password no

User's encrypted password.

The password must be encrypted with the Runtime's encrypt command.

uncryptedPassword no User's uncrypted password.

 

You can have multiple Runtime nodes with the same priority.

In this case the cluster will load balance the requests to one of them with the strategy defined.

 

 The property node

The property node is used to manage the cluster behavior and the syntax is the following:

<property name="property name" value="value"/> 

 

The following properties are available:

Name Possible values Description
loadBalancing.strategy random

The load balancing strategy used to choose a node.

 

Connecting to a cluster

The client.xml being set, we can now connect to our newly created cluster of Runtime.

  1. Launch the startcommand.bat (or. sh) utility that is located in the <stambiaRuntime>/ folder
  2. Connect to the cluster with the connect to <cluster nume> Runtime command

 

Example of output:

> connect to cluster
Connecting to cluster
Connecting to localhost on port 42000
Connection failed
Fallback to lower priority Runtime
Connecting to localhost on port 46000
Connected

 

 You can see here that the connection is redirected automatically to the Runtime on port 46000 after having failed to connect to the one on port 42000.

 

You have no rights to post comments

Articles

Suggest a new Article!