Using a9s RabbitMQ for PCF

This topic describes how to use a9s RabbitMQ for PCF after it has been successfully installed. For more information, see Installing and Configuring a9s RabbitMQ for PCF.

Use a9s RabbitMQ for PCF with an App

To use a9s RabbitMQ for PCF with an app, create a service instance and bind the service instance to your app. For more information on managing service instances, see Managing Service Instances with the cf CLI.

View the a9s RabbitMQ for PCF Service

After the tile is installed, you can see the a9s-rabbitmq and its service plans appear in your PCF marketplace. Run cf marketplace to see the service listing:

$ cf marketplace
Getting services from marketplace in org test / space test as admin...
OK
service         plans                                             description
a9s-rabbitmq36  rabbitmq-single-small, rabbitmq-cluster-small,    This is the anynines rabbitmq 36 service.
                rabbitmq-single-big, rabbitmq-cluster-big

For more information on available service plans, see Configure Service Plans.

Create a Service Instance

To provision a RabbitMQ database, run cf create-service. For example:

$ cf create-service a9s-rabbitmq36 rabbitmq-single-small my-rabbitmq-service

Depending on your infrastructure and service broker utilization, it might take several minutes to create the service instance.

Run the cf services command to view the creation status. This command displays a list of all your service instances. To view the status of a specific service instance, run cf service NAME-OF-YOUR-SERVICE.

Bind an App to a Service Instance

After your databse is created, run cf bind-service to bind the service to your app:

$ cf bind-service a9s-rabbitmq-app my-rabbitmq-service

Restage or Restart Your App

To enable your app to access the service instance, run cf restage or cf restart to restage or restart your app.

Obtain Credentials for Accessing Your Service Instance

After a service instance is bound to an app, PCF stores the credentials of your RabbitMQ database in the environment variables of the app. Run cf env APP-NAME to display the environment variables.

You can find the credentials in the VCAP_SERVICES key.

$ cf env a9s-rabbitmq-app
Getting env variables for app a9s-rabbitmq-app in org test / space test as admin...
OK

System-Provided:
{
 "VCAP_SERVICES": {
  "a9s-rabbitmq": [
   {
    "credentials": {
     "default_database": "d22906",
     "hosts": [
      "EXAMPLE-HOST"
     ],
     "password": "EXAMPLE-PASSWORD",
     "uri": "EXAMPLE-URI",
     "username": "EXAMPLE-USERNAME"
    },
    "label": "a9s-rabbitmq",
    "name": "my-rabbitmq-service",
    "plan": "rabbitmq-single-small",
    "tags": [
     "nosql",
     "database",
     "document store",
     "eventual consistent"
    ]
   }
  ]
 }
}
...

You can use the host, username, and password to connect to your database with a RabbitMQ client.

Delete a a9s RabbitMQ for PCF Service Instance

Warning: This operation cannot be undone, and the data is lost when the service instance is deleted. If you want to keep your data, you must back up your database before deleting the service instance.

Follow the steps below to unbind the service instance from all apps and then delete it.

List Available Services

Run cf services to list available service instances and get the name of the service instance you want to delete.

$ cf services

Getting services in org test / space test as admin...
OK

name                  service          plan                    bound apps         last operation
my-rabbitmq-service   a9s-rabbitmq36   rabbitmq-single-small   a9s-rabbitmq-app   create succeeded

This example shows that my-rabbitmq-service is bound to the a9s-rabbitmq-app app.

Unbind a Service Instance

Run cf unbind-service to unbind the service instance from your app.

$ cf unbind-service a9s-rabbitmq-app my-rabbitmq-service

Delete a Service Instance

Run cf delete-service INSTANCE-NAME to delete the service instance:

$ cf delete-service my-rabbitmq-service

It might take several minutes to delete the service. Deleting a service deprovisions the corresponding infrastructure resources. Run the cf services command to view the deletion status.

Upgrade the Service Instance to another Service Plan

Once created, you can upgrade your service instance to another, larger service plan. A larger service plan provides more CPU, RAM and storage. For more information, see the Update a Service Instance of Managing Service Instances with the cf CLI.

$ cf update-service my-rabbitmq-service -p a-bigger-plan

Here are the plans you can upgrade to depending on the one you are currently using:

  • If you are currently using the rabbitmq-single-small plan, you can upgrade to the rabbitmq-single-big plan.

  • If you are currently using the rabbitmq-cluster-small plan, you can upgrade to the rabbitmq-cluster-big plan.

Add a Graphite Endpoint

If you want to monitor your service with Graphite, you can set an endpoint to where to information will be sent with the cf update-service command. This command expects the -c flag and a JSON string containing the graphite and metrics_prefix keys.

$ cf update-service my-rabbitmq-service -c '{ "graphite": ["yourspace.your-graphite-endpoint.com:12345"], "metrics_prefix": "your-api-key.my-cluster-rabbitmq" }'

Add a Syslog Endpoint

You can stream your syslog to a third-party service using the cf update-service command and the -c flag. In this case, the command expects a JSON string containing the syslog key.

$ cf update-service my-rabbitmq-service -c '{ "syslog": ["logs4.your-syslog-endpoint.com:54321"] }'
Create a pull request or raise an issue on the source for this page in GitHub