Azure Redis Cache is based on the popular open-source Redis cache. It gives you access to a secure, dedicated Redis cache, managed by Microsoft and accessible from any application within Azure. This broker currently publishes a single service and plan for provisioning Azure Redis Cache.
- Create a Redis Cache.
- Check whether creating the Redis Cache succeeds or not.
- Collect credentials.
Do nothing.
- Delete the Redis Cache.
- Check whether deleting the Redis Cache succeeds or not.
- Update pricing tier and enableNonSslPort setting according to your updating parameters.
- Get the service name and plans
cf marketplace
Sample output:
service plans description
azure-rediscache basic*, standard*, premium* Azure Redis Cache Service
If you can not find the service name, please use the following command to make the plans public.
cf enable-service-access azure-rediscache
- Create a service instance
Configuration parameters are supported with the provision request. These parameters are passed in a valid JSON object containing configuration parameters, provided either in-line or in a file.
cf create-service azure-rediscache $service_plan $service_instance_name -c $path_to_parameters
Supported configuration parameters:
{
"resourceGroup": "<resource-group-name>", // [Required] Unique. Only allow up to 90 characters
"location": "<location>", // [Required] e.g. eastasia, eastus2, westus, etc. You can use azure cli command 'azure location list' to list all locations.
"cacheName": "<cache-name>", // [Required] Unique. Must be between 3 and 63 characters long. Can only contain numbers, letters, and the - character. The cache name cannot start or end with the - character, and consecutive - characters are not valid.
"parameters": {
"enableNonSslPort": true | false
}
}
For example:
cf create-service azure-rediscache basic myrediscache -c examples/rediscache-example-config.json
The contents of examples/rediscache-example-config.json
:
{
"resourceGroup": "azure-service-broker",
"location": "eastus",
"cacheName": "generated-string",
"parameters": {
"enableNonSslPort": false
}
}
NOTE:
-
Please remove the comments in the JSON file before you use it.
-
The
enableNonSslPort
setting has a effect on theredisUrl
in the credentials delivered by binding. Iftrue
,redisUrl
would be inredis
scheme with port6379
. Else,redisUrl
would be inrediss
scheme with port6380
. Withrediss
, please check if your client supports SSL connection. For Spring Cloud Connector users, you need to upgrade the Connector version to 2.0.3-RELEASE or higher.
Above parameters are also the defaults if the broker operator doesn't change broker default settings. You can just run the following command to create a service instance without the json file:
cf create-service azure-rediscache basic myrediscache
To create redis instances for Spring apps, you need to run:
cf create-service azure-rediscache basic myrediscache -c '{"parameters":{"enableNonSslPort":true}}'
- Check the operation status of creating the service instance
The creating operation is asynchronous. You can get the operation status after the creating operation.
cf service $service_instance_name
For example:
cf service myrediscache
cf bind-service $app_name $service_instance_name
For example:
cf bind-service demoapp myrediscache
Verify that the credentials are set as environment variables
cf env $app_name
The credentials have the following format:
"credentials": {
"hostname": "<cache-name>.redis.cache.windows.net",
"name": "<cache-name>",
"port": 6379,
"primaryKey": "<primary-key>",
"secondaryKey": "<secondary-key>",
"sslPort": 6380,
"redisUrl": "redis://<cache-name>:<primary-key>@<cache-name>.redis.cache.windows.net:6379"
}
NOTE:
- The
redisUrl
would berediss://*****:6380
if non-SSL port is not enabled.
cf unbind-service $app_name $service_instance_name
For example:
cf unbind-service demoapp myrediscache
cf update-service $service_instance_name -p $plan_name -c $updating_parameters
For example:
cf update-service myrediscache -p standardc0 -c '{"parameters":{"enableNonSslPort":true}}'
- Updating the service plan.
Note that, you can't change tier family and capacity at the same time in one single request per the limitation of Azure Redis service. For example, you can update from
basicc0
tostandardc0
. But you can't update frombasicc0
tostandardc1
. You need to update frombasicc0
tostandardc0
, then fromstandardc0
tostandardc1
. - Updating the service properties.
Currently, only the
enableNonSslPort
setting is supported to update.
cf delete-service $service_instance_name -f
For example:
cf delete-service myrediscache -f