# Cheat Sheet

## Cluster Formation and Peer Discovery

If you have a Kubernetes cluster with node auto scaling, nodes will be added and removed dynamically, in this case RabbitMQ must have the following plugins:

{% code title="/etc/rabbitmq/enabled\_plugins" %}

```
[
  rabbitmq_shovel,
  rabbitmq_shovel_management,
  rabbitmq_federation,
  rabbitmq_federation_management,
  rabbitmq_top,
  rabbitmq_peer_discovery_k8s,
  
  rabbitmq_stomp,
  rabbitmq_web_stomp,

  rabbitmq_consistent_hash_exchange,
  rabbitmq_management,
  rabbitmq_peer_discovery_k8s
  
].
```

{% endcode %}

{% code title="/etc/rabbitmq/rabbitmq.conf" %}

```
## Clustering
cluster_formation.peer_discovery_backend  = rabbit_peer_discovery_k8s
cluster_formation.k8s.host = kubernetes.default.svc.cluster.local
cluster_formation.k8s.address_type = hostname
cluster_formation.node_cleanup.interval = 10
# Set to false if automatic cleanup of absent nodes is desired.
# This can be dangerous, see http://www.rabbitmq.com/cluster-formation.html#node-health-checks-and-cleanup.
cluster_formation.node_cleanup.only_log_warning = true
cluster_partition_handling = autoheal

management.load_definitions = /etc/definitions/definitions.json

## Memory-based Flow Control threshold
vm_memory_high_watermark.absolute = 4096MB
```

{% endcode %}

### References

<https://www.rabbitmq.com/cluster-formation.html#peer-discovery-k8s>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.devops.buzz/public/rabbitmq/untitled.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
