Queue Limit in RabbitMQ for non-HA
Queue Limit in RabbitMQ for non-HA in RabbitMQ Issues.
Queue Limit in RabbitMQ for non-HA#
-
Delete the policies either in RabbitMQ UI or RabbitMQ server.
-
Follow the below steps in RabbitMQ UI
- Login to RabbitMQ UI.
- Click on Admin Tab and at right side click on policies
-
Select each policies and delete it one by one
Note: The policies are deleted in order to accommodate changes, test configurations, clean up the configuration, enforce security measures, and facilitate reconfiguration. The specific reasons for policy deletion can vary depending on the evolving needs and maintenance of the RabbitMQ system.
-
Follow the below steps in the RabbitMQ server:
-
List all the policies in RabbitMQ.
rabbitmqctl list_policies -p vhost001Expected Output:
Listing policies for vhost "vhost001" ... vhost name pattern apply-to definition priority vhost001 policy001 queue001 queues {"max-length":100} 0 -
Execute the below curl command to delete the specific policy.
rabbitmqctl clear_policy -p vhost001 <policy name>For Example:
rabbitmqctl clear_policy -p vhost001 <policy001>Expected Output:
Successful: If the above executed command is successful, then there wont be any output but the policy will be deleted. To check the same, list the policies in the virtual host.
Unsuccessful: If the command is not executed successful, then there will be an error displayed in the output.
Error: Policy '<policy001>' not found in virtual host 'vhost001'. -
Login to RabbitMQ container:
podman ps | grep -i rabbitmqExpected Output:
068f8919vfc0 support.heal:8091/rabbitmq:3.11 2 weeks ago Up 2 weeks rabbitmq-node1-56ce3ec5-8366-9b2a-b0fa-469f078b700f -
Collect the container ID and execute the below command:
podman exec -it <container ID> bashFor Example:
podman exec -it 068f8919bfc4 bashExpected Output:
[root@support-n1 Heal]# podman exec -it 068f8819bfc4 bash bash-5.1# -
Confirm if all the policies are deleted inside the container.
rabbitmqctl list_policiesExpected Output:
Listing policies for vhost "/" .. . vhost name pattern apply-to definition priority / ha-policy . queues { "max-length- bytes" :10000 } 0
-
-
-
Run the below curl command from RabbitMQ heal server:
curl -X PUT -k --user guest:guest -H 'content-type: application/json' --data '{"pattern": ".", "apply-to": "queues", "definition": {"max-length": 10000} }' https://<primaryiprabbitmq>: <rabbitmqwebport>/api/policies/%2f/ha-policyChange the Max-length as per requirement default we will set 10000.
Expected Output:
Successful: There wont be any output if the command is successful.
Unsuccessful: The below error will be obtained when the curl command is unsuccessful.
-
Navigate to purge all the queues either in RabbitMQ UI or RabbitMQ server, as below:
- Purge the queues in RabbitMQ UI
- Click on Queues and then click on the Que Name.
- Click on the Purge Messages and OK.
-
Purge all the queues in RabbitMQ server.
-
List all the RabbitMQ queues
rabbitmqctl list_policiesExpected Output:
Timeout: 60.0 seconds ... Listing queues for vhost / ... name messages a1-event-messages 5 raw-forensic-messages 2 collation-messages 0 nor-thresholds 0 agent-maintenance-response-messages 0 anomaly-event-signal-messages 0 collated-transaction-messages 0 violated-events 0 anomaly-event-action-messages 12 static-aggregated-kpi 24 signal-messages 4 command-messages 0In the above output, there are few queues with values.
-
Purge the each que as below:
rabbitmqctl purge_queue a1-event-messagesExpected Output:
Purging queue 'a1-event-messages' in vhost '/' ... -
Once all the queues are purged, check the status of the que’s to confirm the same:
rabbitmqctl list_queuesExpected Output:
Timeout: 60.0 seconds ... Listing queues for vhost / ... name messages a1-event-messages 0 raw-forensic-messages 0 collation-messages 0 nor-thresholds 0 agent-maintenance-response-messages 0 anomaly-event-signal-messages 0 collated-transaction-messages 0 violated-events 0 anomaly-event-action-messages 0 static-aggregated-kpi 0 signal-messages 0 command-messages 0Once all the queues are purged the status should be 0 in all the que’s.
-
- Purge the queues in RabbitMQ UI
"Out of Memory" (OOM) Issues With RabbitMQ#
The RabbitMQ service restarts due to OOM. The causes for this issue are as follows:
- The high load could be attributed to inadequate memory allocation.
- Certain queue data may not have been processed due to inactive jobs, causing the queue size to escalate.
To resolve the issue, follow the below steps:
- Refer to OOM Issues With Services
-
Navigate to the below file:
rabbitmq.nomad -
Increase the memory for Rabbit MQ in the file (according to load), as below.
-
List the que’s present in RabbitMQ
rabbitmqctl list_queuesExpected Output:
Timeout: 60.0 seconds ... Listing queues for vhost / ... name messages a1-event-messages 5 raw-forensic-messages 2 collation-messages 0 nor-thresholds 0 agent-maintenance-response-messages 0 anomaly-event-signal-messages 0 collated-transaction-messages 0 violated-events 0 anomaly-event-action-messages 12 static-aggregated-kpi 24 signal-messages 4 command-messages 0 -
Restrict the required queue size by using the command:
rabbitmqctl set_policy setting-queue-limit "<queue name>" '{"max- length":<value>}'"max-length" parameter: Specify the desired number of messages to retain within the queue, the remaining will be purged.
For Example:
rabbitmqctl set_policy setting-queue-limit "raw-forensic-messages" '{"max-length":10000}'- Successful: There wont be any output if the command is successful.
- Unsuccessful: The error message will be obtained when the curl command is unsuccessful.
-