Management
Generally, most management tasks are handled via the RabbitMQ Management Plugin and RabbitMQ Management HTTP API.
The RabbitMQ Helper uses the API to either automate or to assist with the following:
- RabbitMQ Node Diagnostics.
- Remove All Queues on a RabbitMQ Node.
RabbitMQ Node Diagnostics
The Helper contains several cmdlets that allow you to extract information about your cluster nodes and queues. You can use standard Powershell syntax to suit your needs.
The examples below represent a node where the Helper is installed. It is available to use the -Verbose
switch for more details.
User Credential Validation
Assert-RabbitMqConnectivity
$usercred = Get-Credential -Message "Enter the RabbitMq user username and
password to validate";
Assert-RabbitMqConnectivity -Credential $usercred
Assert-RabbitMqConnectivity -Hostname Nefarian -Credential $usercred
Node and Queue Information
#check to make sure RabbitMq is running
Assert-RabbitMqIsRunning
$admincred = Get-Credential -Message “Enter the administrative user RabbitMq user username and password”;
#get the cluster name
Get-RabbitMqClusterName -AdminCredential $admincred
#get all cluster nodes
$nodes = Get-RabbitMqClusterNodes -AdminCredential $admincred
#select basic node information
$nodes | Select name,type,running
#request the current node to conduct a health-check
Request-RabbitMqHealthCheck -AdminCredential $admincred
$queues = Get-RabbitMqQueues -AdminCredential $admincred
#select all queues which have a node as their master node
$queues | Where-Object {$_.node -eq ‘rabbit@Nefarian’} | Select name | format-list
$queues | Where-Object {$_.node -eq ‘rabbit@Nefarian’} | Measure
#select all queues which do not have a node as their master node
$queues | Where-Object {$_.node -ne ‘rabbit@Nefarian’} | Select name,node | format-list
$queues | Where-Object {$_.node -ne ‘rabbit@Nefarian’} | Measure
#select all queues which have a node as their salve node
$queues | Where-Object {$_.slave_nodes.Contains(‘rabbit@Nefarian’)} | Select name,node | format-list
#select all queues and their respective effective policies
$queues | Select name,effective_policy_definition | format-list
Remove All Queues on a RabbitMQ Node
For debugging and testing purposes, you can remove all queues by using the following cmdlet:
Remove- RabbitMqQueues
When running this command, you are asked for the admin credentials that are created when RabbitMQ is installed.
After running this command, make sure that you restart Secret Server.