Redis HBO Provider

Redis HBO Provider allows loading a custom configured Redis Client for storing/retrieving Historical Stats. The Redis client is stateful and is based on Lettuce . Both RedisClient and RedisClusterClient are supported, RedisClusterAsyncCommandsFactory is meant to be extended by the user for custom configurations

Configuration

Create etc/catalog/hbo-provider.properties to mount the Redis HBO Provider Plugin, replacing the properties as appropriate:

Configuration properties

The following configuration properties are available:

Property Name Description
coordinator Boolean property whether Presto server is a coordinator
hbo.redis-provider.server_uri Redis Server URI
hbo.redis-provider.total-fetch-timeoutms Maximum timeout in ms for Redis fetch requests
hbo.redis-provider.total-set-timeoutms Maximum timeout in ms for Redis set requests
hbo.redis-provider.default-ttl-seconds TTL in seconds of the Redis data to be stored
hbo.redis-provider.enabled Boolean property whether this plugin is enabled in production
credentials-path Path for Redis credentials
hbo.redis-provider.cluster-mode-enabled Boolean property whether cluster mode is enabled

Credentials

The plugin requires the Redis Server URI property hbo.redis-provider.server_uri in order to access Redis. Based on your custom Redis deployment you may need to add additional credentials.

Local Test setup

Set up local Redis Cluster with the guideline of Redis.

Add ../redis-hbo-provider/pom.xml,\ to presto-main/etc/config.properties.

Add the following config file in presto-main/etc/hbo-provider.properties

1. coordinator=true
2. hbo.redis-provider.enabled=true
3. hbo.redis-provider.total-fetch-timeoutms=5000
4. hbo.redis-provider.total-set-timeoutms=5000
5. hbo.redis-provider.default-ttl-seconds=4320000
6. hbo.redis-provider.cluster-mode-enabled=true
7. hbo.redis-provider.server_uri=redis://localhost:7001/

Production Setup

  1. You can place the plugin JARs in the production’s plugins directory.

  2. Alternatively, follow this method to ensure that the plugin is loaded during the Presto build. Steps to register the plugin in production

  3. Add the following to register the plugin in <fileSets> in presto-server/src/main/assembly/presto.xml

1. <fileSet>
2. <directory>${project.build.directory}/dependency/redis-hbo-provider-${project.version}</directory>
3. <outputDirectory>plugin/redis-hbo-provider</outputDirectory>
4. </fileSet>
  1. Add META-INF.services file in redis-hbo-provider/src/main/resources with the Plugin entry class com.facebook.presto.statistic.RedisProviderPlugin
  2. Add dependency on the module in presto-server/pom.xml
1. <dependency>
2. <groupId>com.facebook.presto</groupId>
3. <artifactId>redis-hbo-provider</artifactId>
4. <version>${project.version}</version>
5. <type>zip</type>
6. <scope>provided</scope>
7. </dependency>
  1. You can add your custom Redis client connection login in com.facebook.presto.statistic.RedisClusterAsyncCommandsFactory, just make sure that the AsyncCommands are provided properly