> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-86180b7b.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Redis 字典源

> 在 ClickHouse 中将 Redis 配置为字典源。

设置示例：

<Tabs>
  <Tab title="DDL">
    ```sql theme={null}
    SOURCE(REDIS(
        host 'localhost'
        port 6379
        storage_type 'simple'
        db_index 0
    ))
    ```
  </Tab>

  <Tab title="配置文件">
    ```xml theme={null}
    <source>
        <redis>
            <host>localhost</host>
            <port>6379</port>
            <storage_type>simple</storage_type>
            <db_index>0</db_index>
        </redis>
    </source>
    ```
  </Tab>
</Tabs>

<br />

设置字段：

| Setting        | Description                                                                                         |
| -------------- | --------------------------------------------------------------------------------------------------- |
| `host`         | Redis 主机地址。                                                                                         |
| `port`         | Redis 服务器的端口。                                                                                       |
| `storage_type` | 用于处理键的 Redis 内部存储结构。`simple` 用于简单源和哈希单键源，`hash_map` 用于包含两个键的哈希源。不支持范围源以及使用复杂键的缓存源。默认值为 `simple`。可选。 |
| `db_index`     | Redis 逻辑数据库的数字索引。默认值为 `0`。可选。                                                                       |
