Using DataStax Cassandra Service Broker for PCF

You can create service instances of DataStax Cassandra Service Broker for PCF and bind them to apps using either Apps Manager or the Cloud Foundry Command-Line Interface (cf CLI).

Download an example app that uses DataStax Cassandra Service Broker for PCF here.

Create a Service Instance

Creating a service instance in PCF automatically creates an associated user account in the Cassandra cluster, to let the instance access the cluster. If the service plan specifies a Cassandra role, this user account has this role; otherwise the instance logs in as admin.

The following procedures describe how to create a DataStax Cassandra service instance in Apps Manager and with the cf CLI.

Pivotal Apps Manager

  1. From Apps Manager, select Marketplace from the left navigation menu under Spaces. This displays the Services Marketplace.
  2. Select DataStax Cassandra Service Broker for PCF from the tiles.
  3. Click on the Select this plan button to select the Basic Service Plan.
  4. In the Instance Name field, enter a name that will identify this specific DataStax Cassandra Service Broker for PCF service instance.
  5. From the Add to Space drop-down list, select the space where apps will bind to the service.
  6. Click the Add button to create the service instance.

cf CLI

  1. Run cf marketplace to view the available service plans. This should produce output like the following:

    $ cf marketplace
    
    Getting services from marketplace in org system / space apps-manager as admin...
    OK
    
    service              plans          description
    p-dse-cassandra-sb   basic          A service broker for DataStax Enterprise Cassandra.
    
    TIP:  Use 'cf marketplace -s SERVICE' to view descriptions of individual plans of a given service.
    
  2. Run cf create-service SERVICE-NAME SERVICE-PLAN SERVICE-INSTANCE-NAME to create the service plan. SERVICE-INSTANCE-NAME can be any descriptive name you want to use for the service instance:

    $ cf create-service p-dse-cassandra-sb basic cassie
    

Bind an App to a Service Instance

The following procedures describe how to bind a DataStax Enterprise Cassandra service instance to a PCF app using Pivotal Apps Manager or the cf CLI.

Pivotal Apps Manager

  1. In a space, select the app to bind to the service.
  2. Select the Services tab for the app. A page displays showing the service instances that are already bound to this app.
  3. Click Bind a Service. A dropdown appears with a list of available service instances.
  4. Select the DataStax Enterprise Cassandra service instance you created in the previous section and click Bind.
  5. Use the cf CLI to start or restage your application.

    $ cf restage spring-music
    

cf CLI

  1. Run cf services to view running service instances. This should produce output like the following:

    $ cf services
    
    Getting services in org system / space apps-manager as admin...
    OK
    
    name                        service             plan        bound apps    last operation
    cassie                      p-dse-cassandra-sb  basic                     create succeeded
    
  2. Run cf bind-service APP-NAME SERVICE-INSTANCE-NAME to bind the application to the service instance.

    $ cf bind-service spring-music cassie
    
  3. Restage your app.

    $ cf restage spring-music
    

Delete a Service Instance

When you delete a DataStax Enterprise Cassandra service instance, the service broker automatically unbinds all apps that are bound to that service and removes from the Cassandra cluster any users created for binding apps.

Pivotal Apps Manager

  1. From the Services tab for the space containing the instance, select the service instance.
  2. Open the Settings tab and click Delete Service Instance.
  3. You may need to restage or re-push any apps that used the service for the changes to take effect.

    $ cf restage spring-music
    

cf CLI

  1. Run cf delete-service SERVICE-INSTANCE-NAME to delete the service instance. Enter y when prompted. This produces output like the following:

    $ cf delete-service cassie
    
    Really delete the service cassie?> y
    Deleting service cassie in org system / space apps-manager as admin...
    OK
    
  2. You may need to restage or re-push any apps that used the service for the changes to take effect.

    $ cf restage spring-music
    
Was this helpful?
What can we do to improve?
Create a pull request or raise an issue on the source for this page in GitHub