tencent cloud

Configure Image Policy
Last updated: 2025-08-11 15:10:10
Configure Image Policy
Last updated: 2025-08-11 15:10:10

Operation Background

To improve the reliability and fault tolerance of the RabbitMQ cluster, when users create a RabbitMQ cluster or a new Vhost (with at least three cluster nodes), we provide users with the option to enable "mirrored queues". This mirrored queue can replicate messages in the queue across multiple nodes in the RabbitMQ cluster, ensuring that messages in the queue will not be lost if a node fails.

Use Limits

TDMQ for RabbitMQ only allows clusters with three or more nodes to enable "mirrored queues", mainly to ensure high availability and fault tolerance of the cluster. In a cluster with three or more nodes, mirrored queues can replicate messages across multiple nodes. This way, it can share the load of each node, enhance performance, and ensure normal operation of the service when a node fails. At the same time, it also provides more flexibility, allowing us to flexibly configure the parameters of mirrored queues according to actual needs. Therefore, this limitation is to provide more stable and reliable services.

Enable Default Image Queue

By configuring the default mirrored queue policy, you can ensure RabbitMQ cluster reliability while optimizing performance and resource utilization. Users can further adjust these parameters according to their needs and scenarios, or delete and create new policies.
The following is the detailed parameter description of the "Default Image Queue" policy provided by tencent distributed message queue RabbitMQ for users:
Parameter Name
Configuration Parameters
Parameter Description
Name
pay-mirror-policy
Policy Name, used to identify and refer to this policy.
Pattern
.*
The match mode of the policy uses Regular Expression Syntax. Means to match any characters. Means to match the preceding character zero or multiple times. So .* means to match the name of any queue.
Apply to
Queues
Application object of the policy. Set to Queues indicates that the policy applies to queues.
Priority
0
Priority of the policy. If a queue matches multiple policies, the policy with higher priority will be applied. 0 represents the lowest priority.
ha-mode
exactly
Replication mode of mirrored queues.
exactly: It means that the messages in the queue will be copied to a specified quantity of nodes.
all: It means that the messages in the queue will be copied to all nodes.
Nodes: It means performing mirroring on the specified nodes, and the node names are specified through mirroring parameters.
Selecting "exactly" can reduce network and storage overhead while ensuring availability and improving performance.
ha-params
3
Copy parameters of the mirrored queue. When ha-mode is set to exactly, the number of replicated nodes needs to be set here. By default, it is set to 3. Even if it is expanded to 5 nodes in the future, the performance can still remain at a relatively good level.
ha-promote-on-failure
always
Mirror queue promotion strategy during node fault. Always means that regardless of the causes for node fault, the mirrored queue will be promoted to the main queue. When-synced means that the mirrored queue will be promoted to the main queue only when it is resynchronized after a node fault. The default setting is always to ensure service availability in any failure situation.
ha-promote-on-shutdown
when-synced
Mirror queue promotion strategy during node normal shutdown.
- always: It means that the mirrored queue will be promoted to the main queue regardless of the reasons for node shutdown.
- when-synced: It indicates that the mirrored queue will be promoted to the main queue only after the node is closed and resynchronized.
The default setting is when-synced to avoid unnecessary escalation operations.
ha-sync-mode
manual
Synchronization mode of mirrored queues.
- Automatic: It means that the mirrored queue is automatically synchronized with the main queue when the node starts up or reconnects to the cluster.
- Manual: It indicates a requirement to manually trigger the synchronization operation to synchronize the mirrored queue with the main queue.
The default setting is manual to avoid affecting cluster performance during automatic synchronization when messages accumulate.

Operation Steps

Method one: Enable mirror queue when creating a new cluster: Cluster Purchase Page > Other Configuration > Enable Mirror Queue. This operation only takes effect on the cluster default Vhost.

Method 2: Enable mirror queue when creating a new Vhost: TDMQ for RabbitMQ Console > Cluster Management > Vhost > Creation > Enable Mirror Queue.


Create an Image Policy

When creating a new cluster, if the mirrored queue is enabled, there will be a default policy under the Policy tab on the console. It can be deleted. You can also create or modify a policy again.

Operation Steps

1. Log in to the TDMQ for RabbitMQ console.
2. Select Cluster Management > Vhost in the left sidebar. After selecting a region, click the target Vhost's ID to enter the basic information page.
3. Click Policy > Create Policy, and fill in the basic information of the policy.
Basic Settings:
Parameter
Description
Current Vhost
Indicates which Vhost is being created with an image policy.
Policy Name
1 - 64 characters, only digits, letters, ".", "-" and "_" are allowed.
Match Mode
A regular expression used to match related Queues or Exchanges. For commonly used match mode regular expressions, refer to:
.*: Match all queues or exchanges under this Vhost.
^test.*: Matches all Queues or Exchanges whose names start with "test" under this Vhost.
.*test.*: Matches all Queues or Exchanges whose names contain "test" under this Vhost.
.*test$: Matches all Queues or Exchanges whose names end with "test" under this Vhost.
Policy type
Select Image Policy.
Application Scope
Is used to specify the range where the current Policy takes effect. The image policy is only supported to take effect in the Queue.
Priority
Define the priority of a policy. Optional range: [0, 255]. If multiple policies are applied to the same Queue, the Policy with the highest priority number will be effective.

Policy Definition
Parameter
Description
Mirror mode
Mirror queue mode. Valid values are all, exactly, nodes.
all: Means performing mirroring on all nodes in a cluster.
exactly: Refers to performing mirroring on a specified number of nodes, and the number of nodes is specified by mirror parameters.
Nodes: It means performing mirroring on the specified nodes, and the node names are specified through mirroring parameters.

Mirror parameters
Mirror parameters: It means the nodes to which the message will be synchronized.
When the mirror mode is set to all, this item can be left blank.
When the mirror mode is set to exactly, it is recommended to select 3 for the mirror parameters. The maximum value can be equal to the current number of cluster nodes, and the minimum can be 1.
When the mirror mode is set to nodes, the mirror parameters can be selected according to node names to specify which specific nodes. It is recommended to select 3 nodes.
message synchronization method
Message synchronization method in the mirrored queue, optional automatic or manual.
Primary node exit handling
Whether to allow an unsynced mirror to be elected as the primary node when the primary node quits gracefully.
Primary node fault handling
When a primary node fails, whether to allow the election of an unsynced mirror as the master. To ensure availability, it is recommended to keep "allow selecting all mirrors".

4. Click Complete to complete policy creation. You can see the created policy in the policy list.

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback