Skip to content

Latest commit

 

History

History
208 lines (146 loc) · 9.52 KB

creating-and-managing-a-cluster-manually.adoc

File metadata and controls

208 lines (146 loc) · 9.52 KB

Creating and Managing a Cluster Manually

Enterprise Edition

There are 3 ways to create and manage clusters:

  • Using the Mule Management Console’s graphical interface

  • Using CloudHub - for more information, see Creating and Managing Clusters

  • Manually, using a configuration file

This page describes manual creation and configuration of a cluster. If you want to create and manage a cluster using the Management Console’s graphical interface, see Creating or Disbanding a Cluster.

Caution

Do not attempt mixed management of clusters

If you create a cluster manually, do not attempt to manage it via the Management Console. The Management Console cannot recognize your manually-created cluster, and overwrites your cluster configuration.

Note

All nodes in a cluster must have the same agent version.

Creating a Cluster Manually

Follow this procedure to create a cluster manually, using a configuration file.

  1. Ensure that the node is not running, that is that the Mule Runtime Server is stopped.

  2. Create a file named mule-cluster.properties inside the node’s $MULE_HOME/.mule directory.

  3. Edit the file with parameter = value pairs, one per line. See the example below.

    Note: mule.clusterId and mule.clusterNodeId must be in the properties file.

    ...
    mule.cluster.nodes=192.168.10.21,192.168.10.22,192.168.10.23
    mule.cluster.multicastenabled=false
    mule.clusterId=<Cluster_ID>
    mule.clusterNodeId=<Cluster_Node_ID>
    ...
  4. Repeat this procedure for all Mule servers that you want to be in the cluster.

  5. Start the Mule servers in the nodes.

For the full list of available parameters, see Cluster Configuration Parameters.

Managing a Cluster Manually

Manual management of a cluster is only possible for clusters that have been manually created, which are not managed by the Mule Management Console.

To manually change the configuration of a cluster node, follow these steps:

  1. Stop the node’s Mule server.

  2. Edit the node’s mule-cluster.properties as desired, then save the file.

  3. Restart the node’s Mule server.

Caution

Ensure consistency across nodes

Ensure that the options you apply in the configuration file are valid for all cluster nodes. Failure to do so can cause you to  break the cluster configuration and inadvertently disable the cluster.

Quorum management.

When managing a manually configured cluster you can now set a minimum quorum of machines required for the cluster to be operational.

When partitioning a network, clusters are available by default. However, by setting a minimum quorum size you can configure your cluster to reject updates that do not pass a minimum threshold.
This helps you achieve better consistency and protects your cluster in case of an unexpected loss of one of your nodes (Mule Runtimes in the cluster).

Under normal circumstances, if a node were to die in the cluster, you may still have enough memory available to store your data, but the amount of threads available to process requests would be reduced as you now would have less nodes available and the partition threads in the cluster could quickly become overwhelmed. This could lead to

  • Clients left without threads to process their requests.

  • The remaining members of the cluster become so overwhelmed with requests that they’re unable to respond and are forced out of the cluster on the assumption that they are dead.

To protect the rest of the cluster in the event of member loss, you can set a minimum quorum size to stop concurrent updates to your nodes, and throwing a QuorumException whenever the number of active nodes in the cluster is below your configured value.

Caution

QuorumExceptions must be caught

When configuring a Quorum Size for your cluster, you need to catch the thrown exception to make some sort of decision (e.g. send an email, stop process, logging, retry strategies, etc)

To enable quorum, the mule.cluster.quorumsize property has to be placed on the cluster configurations file {MULE_HOME}/.mule/mule-cluster.properties defining the minimum number of nodes of the cluster to remain in an operational state.

Note

Quorum feature is only valid for components that use Object Store.

Object Store Persistence

You can persistently store JDBC data in a centralized system, accessible from all cluster nodes.

To enable Object store persistency, you need to add new properties to the {MULE_HOME}/.mule/mule-cluster.properties file defining the database configuration values:

  1. mule.cluster.jdbcstoreurl: The JDBC URL for connection to the database

  2. mule.cluster.jdbcstoreusername: Database username

  3. mule.cluster.jdbcstorepassword: Database user password

  4. mule.cluster.jdbcstoredriver: JDBC Driver class name

  5. mule.cluster.jdbcstorequerystrategy: SQL dialect

Always keep in mind that the data storage needs to be hosted in a centralized DB reachable from all nodes.
Don’t use more than one database per cluster.

Check the cluster configuration reference for persistency for details on how to configure these values.

Monitoring

You can monitor the events thrown by the cluster members through the JMX technology.

The JMX monitoring option is disabled by default. In order to enable it, you need to add the mule.cluster.jmxenabled property to the {MULE_HOME}/.mule/mule-cluster.properties configuration file.

Please note that enabling JMX might cause some performance overheads given that the underlying structure adds listeners to get the statistics for each individual node.

Membership Listener

The membership listener allows you to get notifications whenever:

  1. A new member is added to the cluster

  2. An existing member leaves the cluster

When one of these events is triggered, the membership listener outputs the addresses of the members that joined or left respectively.

Cluster Configuration Parameters

The following table lists the parameters of the mule-cluster.properties file.

Property name Description

mule.clusterId

Mandatory. Unique identifier for the cluster. It can be any alphanumeric string.

mule.clusterNodeId

Mandatory. Unique ID of the node within the cluster. It can be any integer between 1 and the number of nodes in the cluster.

mule.cluster.networkinterfaces

Comma-separated list of interfaces to use by Hazelcast. Wildcards are supported, as shown below.

192.168.1.*,192.168.100.25

mule.cluster.nodes

The nodes that belong to the cluster, in the form <host:port>, for example, 172.16.9.24:9000. Specifying just one IP address enables the server to join the cluster.

The port number is optional; if not set, the default is 5701. To include more than one host, create a comma-separated list.

This option configures the cluster with the specified fixed IP addresses. Use this option if you are not relying on multicast for cluster node discovery. If using this option, set mule.cluster.multicastenabled to false, otherwise an exception is thrown when you start the cluster. (see next item in this table).

Examples:

Two nodes listening on port 9000:

172.16.9.24:9000,172.16.9.51:9000

Two nodes listening on port 5701:

192.168.1.19,192.168.1.20

mule.cluster.quorumsize

Enables you to define the minimum number of machines required in a cluster to remain in an operational state.

mule.cluster.multicastenabled

(Boolean) Enable/disable multicast. Set to false if using fixed IP addresses for cluster node discovery (see option mule.cluster.nodes above).
If set to true, do not set IP addresses in mule.cluster.nodes.

mule.cluster.multicastgroup

Multicast group IP address to use.

mule.cluster.multicastport

Multicast port number to use.

mule.cluster.jdbcstoreurl

Required only when storing persistent data.
The JDBC URL for connection to the database

mule.cluster.jdbcstoreusername

Required only when storing persistent data.
Database username

mule.cluster.jdbcstorepassword

Required only when storing persistent data.
Database user password

mule.cluster.jdbcstoredriver

Required only when storing persistent data.
JDBC Driver class name

mule.cluster.jdbcstorequerystrategy

Required only when storing persistent data.
SQL dialect for accessing the stored object data.
This property can take three different values: mssql, mysql and postgresql1.

mule.cluster.jmxenabled

(Boolean) Enable/disable monitoring

mule.cluster.listenersenabled

(Boolean) Enable/disable membership listener. Set to true if you want your nodes to get notified when a member enters or leaves the cluster.

Caution

Oracle database support is a known limitation and is planned for a future release.