> For the complete documentation index, see [llms.txt](https://docs.selfuel.digital/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.selfuel.digital/data-integration-with-nexus/nexus-elements/connectors/source/redis.md).

# Redis

> Redis source connector

### Description[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#description) <a href="#description" id="description"></a>

Used to read data from Redis.

### Key features[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#key-features) <a href="#key-features" id="key-features"></a>

* [x] &#x20;batch
* [ ] &#x20;stream
* [ ] &#x20;exactly-once
* [ ] &#x20;column projection
* [ ] &#x20;parallelism
* [ ] &#x20;support user-defined split

### Options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#options) <a href="#options" id="options"></a>

| name                   | type   | required              | default value |
| ---------------------- | ------ | --------------------- | ------------- |
| host                   | string | yes                   | -             |
| port                   | int    | yes                   | -             |
| keys                   | string | yes                   | -             |
| batch\_size            | int    | yes                   | 10            |
| data\_type             | string | yes                   | -             |
| user                   | string | no                    | -             |
| auth                   | string | no                    | -             |
| db\_num                | int    | no                    | 0             |
| mode                   | string | no                    | single        |
| hash\_key\_parse\_mode | string | no                    | all           |
| nodes                  | list   | yes when mode=cluster | -             |
| schema                 | config | yes when format=json  | -             |
| format                 | string | no                    | json          |
| common-options         |        | no                    | -             |

#### host \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#host-string) <a href="#host-string" id="host-string"></a>

redis host

#### port \[int][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#port-int) <a href="#port-int" id="port-int"></a>

redis port

#### hash\_key\_parse\_mode \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#hash_key_parse_mode-string) <a href="#hash_key_parse_mode-string" id="hash_key_parse_mode-string"></a>

hash key parse mode, support `all` `kv`, used to tell connector how to parse hash key.

when setting it to `all`, connector will treat the value of hash key as a row and use the schema config to parse it, when setting it to `kv`, connector will treat each kv in hash key as a row and use the schema config to parse it:

for example, if the value of hash key is the following shown:

```
{ 
  "001": {
    "name": "tyrantlucifer",
    "age": 26
  },
  "002": {
    "name": "Zongwen",
    "age": 26
  }
}

```

if hash\_key\_parse\_mode is `all` and schema config as the following shown, it will generate the following data:

```

schema {
  fields {
    001 {
      name = string
      age = int
    }
    002 {
      name = string
      age = int
    }
  }
}

```

| 001                             | 002                       |
| ------------------------------- | ------------------------- |
| Row(name=tyrantlucifer, age=26) | Row(name=Zongwen, age=26) |

if hash\_key\_parse\_mode is `kv` and schema config as the following shown, it will generate the following data:

```

schema {
  fields {
    hash_key = string
    name = string
    age = int
  }
}

```

| hash\_key | name          | age |
| --------- | ------------- | --- |
| 001       | tyrantlucifer | 26  |
| 002       | Zongwen       | 26  |

each kv that in hash key it will be treated as a row and send it to upstream.

**Tips: connector will use the first field information of schema config as the field name of each k that in each kv**

#### keys \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#keys-string) <a href="#keys-string" id="keys-string"></a>

keys pattern

#### batch\_size \[int][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#batch_size-int) <a href="#batch_size-int" id="batch_size-int"></a>

indicates the number of keys to attempt to return per iteration,default 10

**Tips:Redis source connector support fuzzy key matching, user needs to ensure that the matched keys are the same type**

#### data\_type \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#data_type-string) <a href="#data_type-string" id="data_type-string"></a>

redis data types, support `key` `hash` `list` `set` `zset`

* key

> The value of each key will be sent downstream as a single row of data. For example, the value of key is `Nexus test message`, the data received downstream is `Nexus test message` and only one message will be received.

* hash

> The hash key-value pairs will be formatted as json to be sent downstream as a single row of data. For example, the value of hash is `name:tyrantlucifer age:26`, the data received downstream is `{"name":"tyrantlucifer", "age":"26"}` and only one message will be received.

* list

> Each element in the list will be sent downstream as a single row of data. For example, the value of list is `[tyrantlucier, CalvinKirs]`, the data received downstream are `tyrantlucifer` and `CalvinKirs` and only two message will be received.

* set

> Each element in the set will be sent downstream as a single row of data For example, the value of set is `[tyrantlucier, CalvinKirs]`, the data received downstream are `tyrantlucifer` and `CalvinKirs` and only two message will be received.

* zset

> Each element in the sorted set will be sent downstream as a single row of data For example, the value of sorted set is `[tyrantlucier, CalvinKirs]`, the data received downstream are `tyrantlucifer` and `CalvinKirs` and only two message will be received.

#### user \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#user-string) <a href="#user-string" id="user-string"></a>

redis authentication user, you need it when you connect to an encrypted cluster

#### auth \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#auth-string) <a href="#auth-string" id="auth-string"></a>

redis authentication password, you need it when you connect to an encrypted cluster

#### db\_num \[int][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#db_num-int) <a href="#db_num-int" id="db_num-int"></a>

Redis database index ID. It is connected to db 0 by default

#### mode \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#mode-string) <a href="#mode-string" id="mode-string"></a>

redis mode, `single` or `cluster`, default is `single`

#### nodes \[list][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#nodes-list) <a href="#nodes-list" id="nodes-list"></a>

redis nodes information, used in cluster mode, must like as the following format:

\["host1:port1", "host2:port2"]

#### format \[string][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#format-string) <a href="#format-string" id="format-string"></a>

the format of upstream data, now only support `json` `text`, default `json`.

when you assign format is `json`, you should also assign schema option, for example:

upstream data is the following:

```

{"code":  200, "data":  "get success", "success":  true}

```

you should assign schema as the following:

```

schema {
    fields {
        code = int
        data = string
        success = boolean
    }
}

```

connector will generate data as the following:

| code | data        | success |
| ---- | ----------- | ------- |
| 200  | get success | true    |

when you assign format is `text`, connector will do nothing for upstream data, for example:

upstream data is the following:

```

{"code":  200, "data":  "get success", "success":  true}

```

connector will generate data as the following:

| content                                               |
| ----------------------------------------------------- |
| {"code": 200, "data": "get success", "success": true} |

#### schema \[config][​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#schema-config) <a href="#schema-config" id="schema-config"></a>

**fields \[config]**[**​**](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#fields-config)

the schema fields of redis data

#### common options[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#common-options) <a href="#common-options" id="common-options"></a>

Source plugin common parameters, please refer to [Source Common Options](/data-integration-with-nexus/nexus-elements/connectors/source/source-common-options.md) for details

### Example[​](https://seatunnel.apache.org/docs/2.3.7/connector-v2/source/Redis#example) <a href="#example" id="example"></a>

simple:

```
Redis {
  host = localhost
  port = 6379
  keys = "key_test*"
  data_type = key
  format = text
}
```

```
Redis {
  host = localhost
  port = 6379
  keys = "key_test*"
  data_type = key
  format = json
  schema {
    fields {
      name = string
      age = int
    }
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.selfuel.digital/data-integration-with-nexus/nexus-elements/connectors/source/redis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
