Using Hazelcast for PCF
This topic describes how developers use Hazelcast for Pivotal Cloud Foundry (PCF).
After your PCF operator installs the Hazelcast for PCF tile, it automatically registers itself to the Marketplace.
Follow these steps to create an instance of the Hazelcast service based on an available plan and bind it to your app. The plans available to you are determined by your PCF operator. For more information about configuring plans, see Installing and Configuring Hazelcast for PCF.
To check availability of Hazelcast for PCF, enter the following command:
$ cf marketplace
$ cf marketplace Getting services from marketplace in org system / space system as admin... OK
service plans description app-autoscaler bronze, gold Scales bound applications in response to load (beta) hazelcast t2.micro, t2.small, m3.medium Hazelcast Service
Create a file named
hazelcast.jsonusing this sample Hazelcast JSON file as a template.
YOUR_LICENSE_KEYwith the active Hazelcast Enterprise License or a trial license. For more information, see License.
To create a cluster, enter the following command:
$ cf create-service hazelcast PLAN SERVICE_INSTANCE_NAME -c hazelcast.json
$ cf create-service hazelcast t2.micro micro-cluster -c hazelcast.json Creating service instance micro-cluster in org system / space system as admin... OK
Create in progress. Use 'cf services' or 'cf service micro-cluster' to check operation status.
To bind the service to your app, enter the following commands:
$ cf bind-service MY-APPLICATION SERVICE_INSTANCE_NAME $ cf restage MY-APPLICATION
$ cf bind-service myapp micro-cluster $ cf restage myapp
Start using the Hazelcast in-memory data grid (IMDG). Necessary parameters are passed to your application in
VCAP_SERVICESenvironment variable. See this sample Hazelcast Spring Boot application for further information.