forked from pivotal-cf/docs-aerospike-ondemand
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathusing.html.md.erb
165 lines (122 loc) · 7.65 KB
/
using.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
---
title: Using Aerospike EE OnDemand Service for PCF
owner: Partners
---
This topic describes how to use Aerospike EE OnDemand Service for Pivotal Cloud Foundry (PCF).
After installing and configuring the Aerospike EE OnDemand Service for PCF tile, developers can create service instances of Aerospike service plans and bind them to their apps using the Cloud Foundry Command Line Interface (cf CLI). Binding an Aerospike service instance to an app provides the app with information it can use to store and retrieve information in an Aerospike database.
When creating an Aerospike service instance, the tile will also create an Aerospike Management Console (AMC) that can be used to monitor the health and activity on the Aerospike cluster.
##<a id='cf-cli'></a>Create and Bind a Service Instance Using the cf CLI
To create an Aerospike service instance using the cf CLI, perform the following steps:
1. Set your API endpoint to the Cloud Controller of your deployment.
<pre class="terminal">
$ cf api api.YOUR-SYSTEM-DOMAIN
Setting api endpoint to api.YOUR-SYSTEM-DOMAIN...
OK
API endpoint: <span>https</span>://api.YOUR-SYSTEM-DOMAIN (API version: 2.59.0)
Not logged in. Use 'cf login' to log in.
</pre>
1. Log in to your deployment and select an org and a space.
<pre class="terminal">
$ cf login
API endpoint: <span>https</span>://api.YOUR-SYSTEM-DOMAIN
Email> user<span>@</span>example.com
Password>
</pre>
1. List the Marketplace services and locate the Aerospike service. The service plans match the namespaces that have been configured on the Aerospike database.
<pre class="terminal">
$ cf marketplace
Getting services from marketplace in org system / space apps-manager as admin...
OK
service plans description
aerospike-on-demand small, medium, large An enterprise-class NoSQL database providing speed at scale
TIP: Use 'cf marketplace -s SERVICE' to view descriptions of individual plans of a given service.
</pre>
1. Create an instance of the Aerospike service, specifying both the name of the service plan and the name of the service instance. This example uses the `small` plan.
<pre class="terminal">
$ cf create-service aerospike-on-demand small YOUR-SERVICE-INSTANCE
</pre>
You can use arbitrary parameters to customize the service instance. See the [Use Arbitrary Parameters](#parameters) section below for more information.
1. Bind the instance to an app, adding a parameter with name `setname`, and set the value to the name of the set in the Aerospike database that this app should use to store its data.
<pre class="terminal">
$ cf bind-service YOUR-APP YOUR-SERVICE-INSTANCE
Binding service YOUR-SERVICE-INSTANCE to app YOUR-APP in org example / space development as [email protected]...
OK
TIP: Use 'cf restage YOUR-APP' to ensure your env variable changes take effect
</pre>
1. Restage the app for the binding to take effect.
<pre class="terminal">
$ cf restage YOUR-APP
</pre>
The app now has all the credentials required to connect to the Aerospike database in the `VCAP_SERVICES` environment variable.
1. Follow the steps in the [Connect to the AMC](#amc) section of this topic to connect to the AMC for your cluster.
##<a id='parameters'></a>Use Arbitrary Parameters
The Aerospike EE OnDemand Service for PCF supports a number of arbitrary parameters to customize the service instance either when creating the instance with `cf create-service` or when updating the instance with `cf update-service`.
###<a id='service'></a>Aerospike Service Parameters
Use the following parameters to customize the Aerospike service instance. If specified, these parameters take precedence over the defaults set up for the plan.
+ `server_instances`: Number of nodes in the cluster
+ `server_vm_type`: VM type to use for each of the cluster nodes, such as `large.mem`
+ `server_persistent_disk_type`: Type of disk to use on each of the cluster nodes
###<a id='namespace'></a>Aerospike Namespace Parameters
Use the following parameters to customize the namespace configured on the Aerospike service instance. If specified, these parameters take precedence over the defaults set up for the plan.
+ `namespace_name`: Name to use for the namespace
+ `namespace_size`: Memory-size to use for the namespace
<p class="note"><strong>Note</strong>: For more information about configuring memory-size, see the Aerospike <a href="http://www.aerospike.com/docs/reference/configuration#memory-size">documentation</a>.</p>
+ `namespace_storage_type`: Storage type to use for the namespace, either `Device` or `Memory`
+ `namespace_replication_factor`: Number of copies of a record to be maintained in the cluster
+ `namespace_default_ttl`: Default time-to-live, in seconds, for a record from the time of creation or last update
+ `namespace_filesize`: Maximum size for each file storage defined in this namespace
+ `namespace_data_in_memory`: Boolean; if `true`, always keep a copy of all data in memory
###<a id='service'></a>AMC Parameter
Use the `amc_route` parameter to customize the route to use when configuring the AMC service. If not specified, a default route will be provided.
###<a id='examples'></a>Examples
Pass arbitrary parameters with a valid JSON object containing the desired parameters. Provide the JSON either in-line or in a file.
Consult the following examples:
* This command creates a service instance called `small_cache` that uses the `small` plan template, but uses `as_cache` for the name of the namespace:
<pre class="terminal">
cf create-service aerospike-on-demand small small_cache -c '{"namespace_name":"as_cache"}'
</pre>
* This command updates an existing service instance and modifies the number of nodes in the cluster:
<pre class="terminal">
cf update-service small_cache -c '{"server_instances":4}'
</pre>
* This command updates an existing service using a JSON file with the parameters:
<pre class="terminal">
cf update-service small_cache -c /tmp/config.json
</pre>
<p class="note"><strong>Note</strong>: If one or more arbitrary parameters are used to create or update a service, you must include those parameters with each update of the service. Otherwise, the default values from the plan will be used instead.</p>
##<a id='amc'></a>Connect to the AMC
To access the AMC for your cluster after creating an Aerospike service instance and binding it to an app, perform the following steps:
1. Inspect the environment of the app to get the URL and credentials for the Aerospike Management Console.
<pre class="terminal">
$ cf env YOUR-APP
Getting env variables for app YOUR-APP in org aerospike-service-broker-org / space YOUR-SPACE as admin...
OK
System-Provided:
{
"VCAP_SERVICES": {
"aerospike-on-demand": [
{
"credentials": {
"aerospike_amc_ips": [
"10.65.179.212"
],
"aerospike_server_ips": [
"10.65.179.211"
],
"amc_address": "https://aerospike-amc.example.com",
"hostname": "10.65.179.211",
"namespace": "as_datastore",
"password": "XXXXXXXXXXXX",
"port": 3000,
"service_type": "small",
"user": "admin"
},
...
</pre>
1. In a browser, navigate to the `amc_address` URL from `VCAP_SERVICES` to connect to the AMC.
1. For **Host Name or IP**, enter the `hostname` IP address from `VCAP_SERVICES` and click **Connect**.
<br><%= image_tag('amc-login-2.png') %>
1. For **Username** and **Password**, enter the `user` and `password` from `VCAP_SERVICES` and click **Login**.
<br><%= image_tag('amc-login-3.png') %>
1. The Aerospike Management Console appears.
<br><%= image_tag('amc.png') %>