0
0
RabbitMQdevops~5 mins

Cluster node types (disc, RAM) in RabbitMQ - Commands & Configuration

Choose your learning style9 modes available
Introduction
RabbitMQ clusters use two types of nodes: disc nodes and RAM nodes. Disc nodes save data to disk, while RAM nodes keep data in memory for faster access but less durability. Choosing the right node type helps balance speed and data safety.
When you want to ensure message durability and recoverability after a server restart, use disc nodes.
When you need faster message processing and can tolerate data loss on node failure, use RAM nodes.
When setting up a RabbitMQ cluster with mixed node types to optimize performance and reliability.
When adding new nodes to an existing cluster and deciding their role based on hardware resources.
When planning maintenance and failover strategies for RabbitMQ clusters.
Commands
Adds a new disc node named rabbit@node1 to the RabbitMQ cluster. Disc nodes store data on disk for durability.
Terminal
rabbitmqctl join_cluster rabbit@node1 --disc
Expected OutputExpected
Node rabbit@node1 added as disc node.
--disc - Specifies the node is a disc node that saves data to disk.
Adds a new RAM node named rabbit@node2 to the RabbitMQ cluster. RAM nodes keep data in memory for faster access but less durability.
Terminal
rabbitmqctl join_cluster rabbit@node2 --ram
Expected OutputExpected
Node rabbit@node2 added as RAM node.
--ram - Specifies the node is a RAM node that stores data in memory.
Shows the current status of the RabbitMQ cluster, including which nodes are disc or RAM nodes.
Terminal
rabbitmqctl cluster_status
Expected OutputExpected
Cluster status of node rabbit@master ... Cluster nodes: disc: [rabbit@node1, rabbit@master] ram: [rabbit@node2] Running nodes: [rabbit@node1, rabbit@node2, rabbit@master] Applications: [rabbitmq_management, rabbitmq_web_dispatch, amqp_client]
Key Concept

Disc nodes save data to disk for safety, RAM nodes keep data in memory for speed; use both to balance durability and performance.

Common Mistakes
Adding all nodes as RAM nodes in a production cluster.
RAM nodes lose data on restart, risking message loss and cluster instability.
Include at least one disc node to ensure data durability and cluster stability.
Confusing the --disc and --ram flags when adding nodes.
Using the wrong flag sets the node type incorrectly, affecting cluster behavior.
Use --disc for nodes that must save data to disk and --ram for nodes optimized for speed.
Summary
Disc nodes store data on disk and provide durability in RabbitMQ clusters.
RAM nodes keep data in memory for faster access but risk data loss on failure.
Use rabbitmqctl commands with --disc or --ram flags to add nodes of the desired type.
Check cluster status to verify node types and cluster health.