This topic contains information for application development with use with the VMware GemFire for Redis Apps add-on.

Eviction and Expiration

Eviction

VMware GemFire for Redis Apps currently supports the Redis noeviction policy. New values are not saved when memory limit is reached.

Warning: Users must use a Key expiration strategy to avoid this situation. This means that users should assign Keys with one of the following:

  • EXPIRE
  • EXPIREAT
  • PEXPIRE
  • PEXPIREAT

Users can also use a custom region configuration, allowing them to customize the data eviction strategy. For more information about setting data eviction settings, see Configure Data Eviction in the VMware GemFire documentation.

Expiration

When setting expiration, keys are expired in two ways, actively and passively:

  • With passive expiration, expiration is evaluated whenever a key is accessed. If the key is due to expire, it is deleted.
  • With active expiration, keys are evaluated every three minutes. If keys are due to expire, they are deleted.

Features and Requirements

  • Applications must use Redis client that supports Redis Cluster commands. Redis Cluster commands have been available since Redis 3 and are available for many of the most popular languages and frameworks.
  • VMware GemFire for Redis Apps currently implements more than 130 Redis commands. These include Redis commands for Strings, Hashes, Lists, Sets, Sorted Sets, and Pub/Sub.
  • For security and operational reasons, VMware GemFire for Redis Apps does not support a Redis configuration file and does not support the CONFIG command.
  • If your application uses Spring Session Data Redis. you must add code like the following to deactivate Spring Session from calling CONFIG.

    @SpringBootApplication
    public class Application {
    
        public static void main(String[] args) {SpringApplication.run(Application.class, args);	}
    
    
      @Bean
      public static ConfigureRedisAction configureRedisAction() {
            return ConfigureRedisAction.NO_OP;
      }
    }
    

    This is a known solution for many Managed Redis products (ElastiCache, Azure Cache for Redis, etc.) that deactivate the CONFIG command for security reasons. For information regarding this decision, see the Spring Session issue report in GitHub.

  • If your application uses redis-py-cluster, you must specify the option “skip_full_coverage_check=True” when creating the connection to the cluster. This is a known solution for many Managed Redis products (ElastiCache, Azure Cache for Redis, etc.) that deactivate the CONFIG command for security reasons. For information regarding this decision, see the AWS Elasticache Restrictions issue report in GitHub.

Application Development with GemFire for TAS

Connecting a Redis client

To connect a Redis application to the VMware GemFire for TAS service instance, you must create a service key. A service instance with GemFire for Redis Apps enabled will include the following additional properties in the service key as well as to the binding environment for the bound app:

  • “uri”: “redis://REDIS-USER:REDIS-PASSWORD@REDIS-HOST-NAME:6379”
  • “hostname”: “REDIS-HOST-NAME”
  • “port”: 6379
  • “username”: “REDIS-USER”
  • “password”: “REDIS-PASSWORD”

Before you begin, note that:

  • Applications must be using a Redis client that supports Redis Cluster mode.
  • VMware GemFire for Redis Apps currently implements a subset of the full set of Redis commands. For more information, see Compatible Redis Commands in the VMware GemFire for Redis Apps documentation.

Follow the steps below to connect a Redis client to the VMware GemFire for TAS service.

  1. Create a service key (if you have not created one already) by running the following command: cf create-service-key MY-INSTANCE MY-KEY

  2. Inspect the service key: cf service-key MY-INSTANCE MY-KEY

    This returns a JSON response (VCAP_SERVICES) containing the fields shown in this example:

     {
       "uri": "redis://developer_GUID:[email protected]:6379",
       "hostname": "redis-endpoint.service-instance-INSTANCE-GUID.bosh",
       "username": "developer_GUID",
       "password": "PASSWORD",
       "port": 6379,
       "users": [
      {
       "password": "PASSWORD",
       "roles": [
       "developer"
       ],
       "username": "developer_GUID"
        }
      ]
     }
    

Note: The username field is the same as the username configured for the developer role. This role has the necessary permissions to access all GemFire for Redis Apps functionality.

If TLS is enabled for the service, the uri scheme will be rediss:, and the port field will be replaced by a tls_port field which must be used for TLS enabled connections. Only one of port or tls_port will be present. Redis clients cannot establish both TLS and non-TLS connections to the same GemFire for Redis Apps service.

  1. Configure the application. You can use the values from the service key to configure the application, as appropriate, to connect to the service.

    For example, a Spring Boot application would need the following set in its application.properties file:

    spring.redis.cluster.nodes=redis-endpoint.service-instance-INSTANCE-GUID.bosh:6379
    spring.redis.username=developer_GUID
    spring.redis.password=PASSWORD
    

    If your application does not use Spring Boot, you must to parse the environment variables using the java-cfenv library

  2. Push your application to your environment with the cf push command.

Note: If you migrate an existing application that uses the Redis tile to GemFire for TAS, you typically must unbind the app from the Redis for TAS tile and rebind the app to GemFire for TAS. - If your app is still bound to the Redis service, unbind it: cf unbind-service APP-NAME SERVICE-INSTANCE-NAME - Bind your app to the new VMware GemFire for TAS service: cf bind-service APP-NAME SERVICE-INSTANCE-NAME

Security

If the VMware GemFire for TAS service is configured to use external authentication (UAA), Redis applications must be configured with a user and associated password that has the PCC_DATA-ACCESS role as described in Configuring User Account and Authentication (UAA) Roles in the VMware GemFire for TAS documentation.

When UAA is configured, the VCAP_SERVICES data will not include a username or password field.

Back Up and Restore

GemFire for Redis Apps does not persist any data to disk, so it is not possible to back up and restore.

check-circle-line exclamation-circle-line close-line
Scroll to top icon