How to Detect RabbitMQ Services Using Classic Queue Mirroring on Tanzu Elastic Application Runtime
search cancel

How to Detect RabbitMQ Services Using Classic Queue Mirroring on Tanzu Elastic Application Runtime

book

Article ID: 425171

calendar_today

Updated On:

Products

VMware Tanzu Platform Core

Issue/Introduction

This article shows a way to automate the first step in How to Detect Policies that Enable Classic Queue Mirroring for RabbitMQ services running on Tanzu Elastic Application Runtime. This may be useful if you have a large amount of service instances to check.

Resolution

  1. Make sure you are on a machine that has access to the BOSH CLI and the CF CLI and is authenticated to both
  2. Run the following commands in order
    1. SERVICE_OFFERING=$(cf curl '/v3/service_offerings?per_page=5000' | jq -r '.resources[] | select(.name=='\"p.rabbitmq\"').guid')
    2. SERVICE_PLANS=$(cf curl "/v3/service_plans?per_page=5000&service_offering_guids=$SERVICE_OFFERING" | jq -r '.resources[].guid' | tr '\n' ',')
    3. RMQ_DEPLOYMENT_NAMES=$(cf curl "/v3/service_instances?per_page=5000&service_plan_guids=$SERVICE_PLANS" | jq -r '.resources[].guid' | sed 's/^/service-instance_/g')
    4. for deployment in $RMQ_DEPLOYMENT_NAMES; do bosh -d $deployment ssh rabbitmq-server -r -c 'source /etc/profile.d/rabbitmq-server-env.sh; sudo /var/vcap/packages/rabbitmq-server/bin/rabbitmq-diagnostics check_if_cluster_has_classic_queue_mirroring_policy'; done
  3. You should get a result for each instance similar to the following example
    • Using deployment 'service-instance_#############'
      
      Task 1257. Done
      
      Instance   rabbitmq-server/#############'
      Stdout     Checking if cluster has any classic queue mirroring policy ...
                 Cluster reported no policies that enable classic queue mirroring
      
      Stderr     Unauthorized use is strictly prohibited. All access and activity
                 is subject to logging and monitoring.
                 Connection to ###.###.###.### closed.
      
      Exit Code  0
      Error      -
    • This example shows Exit Code 0, which means it does not have any classic queue mirroring policy and does not need to be migrated
    • Services that need to be migrated should show a non-zero exit code