|
1 | | -# Redis |
| 1 | +# Redis Sink |
2 | 2 |
|
3 | | -A Redis sink Firehose \(`SINK_TYPE`=`redis`\) requires the following variables to be set along with Generic ones |
| 3 | +Redis Sink is implemented in Firehose using the Redis sink connector implementation in ODPF Depot. You can check out ODPF Depot Github repository [here](https://github.com/odpf/depot). |
4 | 4 |
|
5 | | -### `SINK_REDIS_URLS` |
| 5 | +### Data Types |
| 6 | +Redis sink can be created in 3 different modes based on the value of [`SINK_REDIS_DATA_TYPE`](https://github.com/odpf/depot/blob/main/docs/reference/configuration/redis.md#sink_redis_data_type): HashSet, KeyValue or List |
| 7 | +- `Hashset`: For each message, an entry of the format `key : field : value` is generated and pushed to Redis. Field and value are generated on the basis of the config [`SINK_REDIS_HASHSET_FIELD_TO_COLUMN_MAPPING`](https://github.com/odpf/depot/blob/main/docs/reference/configuration/redis.md#sink_redis_hashset_field_to_column_mapping) |
| 8 | +- `List`: For each message entry of the format `key : value` is generated and pushed to Redis. Value is fetched for the Proto field name provided in the config [`SINK_REDIS_LIST_DATA_FIELD_NAME`](https://github.com/odpf/depot/blob/main/docs/reference/configuration/redis.md#sink_redis_list_data_field_name) |
| 9 | +- `KeyValue`: For each message entry of the format `key : value` is generated and pushed to Redis. Value is fetched for the proto field name provided in the config [`SINK_REDIS_KEY_VALUE_DATA_FIELD_NAME`](https://github.com/odpf/depot/blob/main/docs/reference/configuration/redis.md#sink_redis_key_value_data_field_name) |
6 | 10 |
|
7 | | -REDIS instance hostname/IP address followed by its port. |
| 11 | +The `key` is picked up from a field in the message itself. |
8 | 12 |
|
9 | | -- Example value: `localhos:6379,localhost:6380` |
10 | | -- Type: `required` |
| 13 | +Limitation: Depot Redis sink only supports Key-Value, HashSet and List entries as of now. |
11 | 14 |
|
12 | | -### `SINK_REDIS_DATA_TYPE` |
| 15 | +### Configuration |
13 | 16 |
|
14 | | -To select whether you want to push your data as a HashSet or as a List. |
| 17 | +For Redis sink in Firehose we need to set first (`SINK_TYPE`=`redis`). There are some generic configs which are common across different sink types which need to be set which are mentioned in [generic.md](../advance/generic.md). Redis sink specific configs are mentioned in ODPF Depot repository. You can check out the Redis Sink configs [here](https://github.com/odpf/depot/blob/main/docs/reference/configuration/redis.md) |
15 | 18 |
|
16 | | -- Example value: `Hashset` |
17 | | -- Type: `required` |
18 | | -- Default value: `List` |
19 | 19 |
|
20 | | -### `SINK_REDIS_KEY_TEMPLATE` |
21 | | - |
22 | | -The string that will act as the key for each Redis entry. This key can be configured as per the requirement, a constant or can extract value from each message and use that as the Redis key. |
23 | | - |
24 | | -- Example value: `Service\_%%s,1` |
25 | | - |
26 | | - This will take the value with index 1 from proto and create the Redis keys as per the template\ |
27 | | - |
28 | | -- Type: `required` |
29 | | - |
30 | | -### `INPUT_SCHEMA_PROTO_TO_COLUMN_MAPPING` |
31 | | - |
32 | | -This is the field that decides what all data will be stored in the HashSet for each message. |
33 | | - |
34 | | -- Example value: `{"6":"customer_id", "2":"order_num"}` |
35 | | -- Type: `required (For Hashset)` |
36 | | - |
37 | | -### `SINK_REDIS_LIST_DATA_PROTO_INDEX` |
38 | | - |
39 | | -This field decides what all data will be stored in the List for each message. |
40 | | - |
41 | | -- Example value: `6` |
42 | | - |
43 | | - This will get the value of the field with index 6 in your proto and push that to the Redis list with the corresponding keyTemplate\ |
44 | | - |
45 | | -- Type: `required (For List)` |
46 | | - |
47 | | -### `SINK_REDIS_KEY_VALUE_DATA_PROTO_INDEX` |
48 | | - |
49 | | -This field decides what data will be stored in the value part of key-value pair |
50 | | - |
51 | | -- Example value: `6` |
52 | | - |
53 | | - This will get the value of the field with index 6 in your proto and push that to the Redis as value with the corresponding keyTemplate\ |
54 | | - |
55 | | -- Type: `required (For KeyValue)` |
56 | | - |
57 | | -### `SINK_REDIS_TTL_TYPE` |
58 | | - |
59 | | -- Example value: `DURATION` |
60 | | -- Type: `optional` |
61 | | -- Default value: `DISABLE` |
62 | | -- Choice of Redis TTL type.It can be:\ |
63 | | - - `DURATION`: After which the Key will be expired and removed from Redis \(UNIT- seconds\)\ |
64 | | - - `EXACT_TIME`: Precise UNIX timestamp after which the Key will be expired |
65 | | - |
66 | | -### `SINK_REDIS_TTL_VALUE` |
67 | | - |
68 | | -Redis TTL value in Unix Timestamp for `EXACT_TIME` TTL type, In Seconds for `DURATION` TTL type. |
69 | | - |
70 | | -- Example value: `100000` |
71 | | -- Type: `optional` |
72 | | -- Default value: `0` |
73 | | - |
74 | | -### `SINK_REDIS_DEPLOYMENT_TYPE` |
75 | | - |
76 | | -The Redis deployment you are using. At present, we support `Standalone` and `Cluster` types. |
77 | | - |
78 | | -- Example value: `Standalone` |
79 | | -- Type: `required` |
80 | | -- Default value: `Standalone` |
| 20 | +### Deployment Types |
| 21 | +Redis sink, as of now, supports two different Deployment Types `Standalone` and `Cluster`. This can be configured in the Depot environment variable `SINK_REDIS_DEPLOYMENT_TYPE`. |
0 commit comments