Redis Connector
Each Redis key/value pair is presented as a single row in Presto. Rows can be broken down into cells by using table definition files.
Only Redis string and hash value types are supported; sets and zsets cannot be queried from Presto.
The connector requires Redis 2.8.0 or later.
To configure the Redis connector, create a catalog properties file etc/catalog/redis.properties
with the following content, replacing the properties as appropriate:
You can have as many catalogs as you need, so if you have additional Redis servers, simply add another properties file to etc/catalog
with a different name (making sure it ends in .properties
).
The following configuration properties are available:
Comma-separated list of all tables provided by this catalog. A table name can be unqualified (simple name) and will be put into the default schema (see below) or qualified with a schema name (<schema-name>.<table-name>
).
For each table defined here, a table description file (see below) may exist. If no table description file exists, the table will only contain internal columns (see below).
This property is required; there is no default and at least one table must be defined.
redis.default-schema
This property is optional; the default is default
.
The hostname:port
pair for the Redis server.
This property is required; there is no default.
Redis clusters are not supported.
redis.scan-count
The internal COUNT parameter for Redis SCAN command when connector is using SCAN to find keys for the data. This parameter can be used to tune performance of the Redis connector.
This property is optional; the default is 100
.
redis.key-prefix-schema-table
If true, only keys prefixed with the schema-name:table-name:
are scanned for a table, and all other keys will be filtered out. If false, all keys are scanned. Note that if the schema-name is default schema, then the prefix to be scanned is just table-name:
.
This property is optional; the default is false
.
The character used for separating schema-name
and table-name
when redis.key-prefix-schema-table
is true
This property is optional; the default is :
.
redis.table-description-dir
References a folder within Presto deployment that holds one or more JSON files (must end with .json
) which contain table description files.
This property is optional; the default is etc/redis
.
redis.hide-internal-columns
In addition to the data columns defined in a table description file, the connector maintains a number of additional columns for each table. If these columns are hidden, they can still be used in queries but do not show up in DESCRIBE <table-name>
or .
This property is optional; the default is true
.
The Redis database to query.
This property is optional; the default is 0
.
redis.password
The password for password-protected Redis server.
This property is optional; the default is null
.
For each defined table, the connector maintains the following columns:
For tables without a table definition file, the _key_corrupt
and _value_corrupt
columns will always be false
.
With the Redis connector it’s possible to further reduce Redis key/value pairs into granular cells provided the key/value sting follow a particular format. This process will define new columns that can be further queried from Presto.
A table definition file consists of a JSON definition for a table. The name of the file can be arbitrary but must end in .json
.
In addition to the above Kafka types, the Redis connector supports hash
type for the value
field which represent data stored in the Redis hash.