RabbitMQ for PCF v1.11

Setting Default Policies for the RabbitMQ Service

Understanding a RabbitMQ Policy

You can set a default queue and an exchange policy in the RabbitMQ for Pivotal Cloud Foundry (PCF) tile to be applied to the RabbitMQ cluster. A policy configured in Ops Manager is only applied when a service instance (vhost) is created (using cf create service) and does not affect service instances (vhosts) that have already been deployed. After you deploy the tile, Pivotal recommends that you use the RabbitMQ Management Interface to make configuration changes.

For more information about RabbitMQ policies, see the RabbitMQ documentation.

Here is an example policy that ensures messages are mirrored on two nodes:

  "ha-mode": "exactly",
  "ha-params": 2,
  "ha-sync-mode": "automatic"

The following rules apply to polices set through the RabbitMQ for PCF tile:

  • A new policy, or an update to a policy, only applies to new instances (vhosts). Existing instances are not affected by the policy.
  • The policy can only be deleted manually from the RabbitMQ nodes.
  • Policies can be added dynamically using the RabbitMQ Management Interface.
  • It is not possible to use pattern matching with policies. Policies will be applied to all queues and exchanges.

    For granular policy settings, Pivotal recommends using the RabbitMQ Management UI. Set a priority number lower than 50 (which is the default priority number when applied through the Ops Manager configuration).

Operators should consider some of the performance implications of making queues and exchanges highly available. For more information on highly available queues, see the RabbitMQ documentation.

Setting or Changing the Policy

To set the RabbitMQ policy, do the following:

  1. From the Ops Manager Installation Dashboard, click the RabbitMQ for PCF tile and then click RabbitMQ Policy.

    Policy opsman

  2. Select Enable custom policy on new instances.

  3. In the Policy for new instances field, paste the policy.

    The policy must be valid JSON and should meet valid RabbitMQ policy criteria.

  4. In the Select the network partition behavior of the RabbitMQ cluster, choose the desired behavior: pause_minority or autoheal.

    For more information on these options and on RabbitMQ clusters and network partitions, see the RabbitMQ documentation.

    For production purposes, Pivotal recommends that customers have at least three RabbitMQ server nodes and two HAProxies spread across low latency availability zones.

Note: No policy validation occurs during the deployment, and errors can cause the deployment to fail or policies to be applied incorrectly.

Viewing Policies in the RabbitMQ Management Dashboard

You can view RabbitMQ policies in the RabbitMQ Management Dashboard, shown below. The example policy entered in the RabbitMQ for PCF tile above is applied to all queues and given a Priority of 50. This allows you to override it by defining another policy with a higher priority.

Policy config

In the Queues section shown below, you can see that any new queues created have the policy automatically applied.

Policy queue

Note: Developers can obtain the URL of the policy from VCAP_SERVICES for app developers.

Create a pull request or raise an issue on the source for this page in GitHub