== Clustering To enable clustering you need to have * at least two appNG Nodes * a load balancer that is able to distribute requests between several nodes, for example http://www.haproxy.org/[HAProxy^] * set the {manager-guide}#platform-properties[platform property^] `messagingEnabled` to `true` * configure the details for the chosen message exchange There are currently three techniques for appNG to exchange messages between nodes in a cluster: * https://en.wikipedia.org/wiki/Multicast[Multicast^] * https://hazelcast.org[Hazelcast^] * https://redis.io[Redis^] * https://www.rabbitmq.com[RabbitMQ^] === Using Multicast The following platform-properties need to be configured when using multicast: * set `messagingReceiver` to `org.appng.core.controller.messaging.MulticastReceiver` (this is the default) * set `messagingGroupAddress` to an appropriate value (default: `224.2.2.4`) * set `messagingGroupPort` to an appropriate value (default: `4000`) === Using Hazelcast With https://hazelcast.org[Hazelcast^], a https://docs.hazelcast.org/docs/4.0/manual/html-single/index.html#reliable-topic[Reliable Topic^] is used to publish and subscribe cluster events. The following platform-properties need to be configured: * set `messagingReceiver` to `org.appng.core.controller.messaging.HazelCastReceiver` * `hazelcastTopicName`: The name of the topic (default: `appng-messaging`) === Using RabbitMQ With https://www.rabbitmq.com[RabbitMQ^], appNG uses a queue based publish/subscribe mechanism for cluster communication. The following platform-properties need to be configured: * set `messagingReceiver` to `org.appng.core.controller.messaging.RabbitMQReceiver` * `rabbitMQAdresses`: A comma separated list of : for RabbitMQ server(s) (default: `localhost:5672`): * `rabbitMQUser`: Username (default: `guest`) * `rabbitMQPassword`: Password (default: `guest`) * `rabbitMQExchange`: Name of the exchange where the receiver binds its messaging queue on. + Be aware that this name must be different among different clusters using the same RabbitMQ server (default: `appng-messaging`). * `rabbitMQAutoDeleteQueue`: If the queue to create should be marked as auto-delete (default: `true`). * `rabbitMQDurableQueue`: If the queue to create should be marked as durable (default: `false`). * `rabbitMQExclusiveQueue`: If the queue to create should be marked as exclusive (default: `true`). === Using Redis With https://redis.io[Redis^], cluster communication is based on a publish/subscribe mechanism that works on a messaging channel. The following platform-properties need to be configured: * set `messagingReceiver` to `org.appng.core.controller.messaging.JedisReceiver` * `redisMessagingHost`: Host of the Redis server (default: `localhost`). * `redisMessagingPort`: Port of the Redis server (default: `6379`). * `redisMessagingPassword`: Password of the Redis server (no default). * `redisMessagingTimeout`: Timeout is optional. If not defined, Redis default is used (no default). * `redisMessagingChannel`: Channel where all cluster nodes should publish and subscribe. + Be aware that this name must be different among different clusters using the same Redis server (default: `appng-messaging`).