Using Altoros Elasticsearch for PCF

This topic describes how to use Altoros Elasticsearch for PCF after it has been installed.

Use Altoros Elasticsearch for PCF with applications

Follow the procedures below to create and bind a service instance to your applications.

View the Service

Once the tile has been installed, a-elasticsearch and its service plans appear in your Marketplace. Run the cf marketplace command to see the service listing.

$ cf marketplace
Getting services from marketplace in org admin / space dev as admin...
OK

service           plans     description
a-elasticsearch   default   Shared Elasticsearch Cluster

Create a Service Instance

Use the cf create-service command to provision a keyspace.

$ cf create-service a-elasticsearch default elasticsearch

Check the service creation status using the cf services command. It displays the list of all your service instances. To check the status of any specific service instance, run cf service a-elasticsearch.

Bind the Service Instance to an App

After you have created your keyspace, run the cf bind-service command to bind the service to your app.

$ cf bind-service sample-app elasticsearch

Restage or Restart Your App

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

Obtain the Service Instance Access Credentials

After you have bound your service instance to your app, you can find the credentials of your Elasticsearch user in the environment variables of the app.

Run cf env APP-NAME to display environment variables. The credentials are listed under the VCAP_SERVICES key.

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

System-Provided:
{
 "VCAP_SERVICES": {
  "a-elasticsearch": [
   {
    "credentials": {
     "index": "ajwwhthctcua",
     "nodes": [
      "192.168.111.53",
      "192.168.111.55",
      "192.168.111.54"
     ],
     "password": "fplsjfbcxoeffr",
     "username": "xhxkqfda"
    },
    "label": "a-elasticsearch",
    "name": "elasticsearch",
    "plan": "default",
    "provider": null,
    "syslog_drain_url": null,
    "tags": [
     "elasticsearch",
     "logs"
    ],
    "volume_mounts": []
   }
  ]
 }
}
...

You can use these parameters to connect to Elasticsearch.

Delete an Altoros Elasticsearch for PCF Service Instance

WARNING! Before deleting a service instance, you must back up data stored in your keyspace. This operation cannot be undone, and all the data is lost when the service is deleted.

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

List All Available Services

Run the cf service command to list available services.

$ cf services
Getting services in org system / space test as admin...
OK

name            service           plan      bound apps   last operation
elasticsearch   a-elasticsearch   default   sample-app   create succeeded

This example shows that elasticsearch is bound to the sample-app app.

Unbind a Service Instance

Run cf unbind to disconnect the service from your app:

$ cf unbind-service sample-app elasticsearch

Delete a Service Instance

Run cf delete-service to remove the service.

  $ cf delete-service elasticsearch

Run the cf services command to check the deletion status.

Create a pull request or raise an issue on the source for this page in GitHub