|
| 1 | +--- |
| 2 | +Title: Redis modules on Kubernetes |
| 3 | +alwaysopen: false |
| 4 | +categories: |
| 5 | +- docs |
| 6 | +- operate |
| 7 | +- kubernetes |
| 8 | +description: Deploy Redis Enterprise databases with modules using the Redis Enterprise operator for Kubernetes. |
| 9 | +linkTitle: Redis modules |
| 10 | +weight: 15 |
| 11 | +--- |
| 12 | + |
| 13 | +Redis Enterprise modules extend Redis functionality with additional data types, commands, and capabilities. The Redis Enterprise operator supports deploying databases with modules through the `RedisEnterpriseDatabase` (REDB) and `RedisEnterpriseActiveActiveDatabase` (REAADB) custom resources. |
| 14 | + |
| 15 | +## Prerequisites |
| 16 | + |
| 17 | +Before you begin, verify that you have: |
| 18 | + |
| 19 | +- Redis Enterprise operator deployed in your Kubernetes cluster |
| 20 | +- Redis Enterprise Cluster (REC) running and in a healthy state |
| 21 | +- Modules uploaded to the Redis Enterprise cluster (see [Check available modules](#check-available-modules)) |
| 22 | + |
| 23 | +## Available modules |
| 24 | + |
| 25 | +Redis Enterprise includes several built-in modules: |
| 26 | + |
| 27 | +- **RediSearch** (`search`) - Full-text search and secondary indexing |
| 28 | +- **RedisJSON** (`ReJSON`) - JSON data type support |
| 29 | +- **RedisTimeSeries** (`timeseries`) - Time series data structures |
| 30 | +- **RedisBloom** (`bf`) - Probabilistic data structures (Bloom filters, etc.) |
| 31 | +- **RedisGraph** (`graph`) - Graph database capabilities |
| 32 | +- **RedisGears** (`rg`) - Programmable data processing engine |
| 33 | + |
| 34 | +## Check available modules |
| 35 | + |
| 36 | +Before configuring databases with modules, check which modules are available in your cluster: |
| 37 | + |
| 38 | +```bash |
| 39 | +kubectl get rec <cluster-name> -o jsonpath='{.status.modules}' | jq |
| 40 | +``` |
| 41 | + |
| 42 | +This command shows the modules installed in the cluster along with their available versions. |
| 43 | + |
| 44 | +## Install additional modules |
| 45 | + |
| 46 | +If you need to install additional modules or specific versions, upload them using the Redis Enterprise API: |
| 47 | + |
| 48 | +1. Get cluster credentials: |
| 49 | + |
| 50 | + ```bash |
| 51 | + kubectl get secret <cluster-name> -o jsonpath='{.data.username}' | base64 -d |
| 52 | + kubectl get secret <cluster-name> -o jsonpath='{.data.password}' | base64 -d |
| 53 | + ``` |
| 54 | + |
| 55 | +2. Port forward to the cluster API: |
| 56 | + |
| 57 | + ```bash |
| 58 | + kubectl port-forward service/<cluster-name> 9443:9443 |
| 59 | + ``` |
| 60 | + |
| 61 | +3. Upload the module: |
| 62 | + |
| 63 | + ```bash |
| 64 | + curl -k -u <username>:<password> -X POST \ |
| 65 | + -F 'module=@<path-to-module-file>' \ |
| 66 | + https://localhost:9443/v2/modules |
| 67 | + ``` |
| 68 | + |
| 69 | +## Configure databases with modules |
| 70 | + |
| 71 | +### Basic database with modules |
| 72 | + |
| 73 | +The following example shows a `RedisEnterpriseDatabase` with modules: |
| 74 | + |
| 75 | +```yaml |
| 76 | +apiVersion: app.redislabs.com/v1alpha1 |
| 77 | +kind: RedisEnterpriseDatabase |
| 78 | +metadata: |
| 79 | + name: search-db |
| 80 | + labels: |
| 81 | + app: redis-enterprise |
| 82 | +spec: |
| 83 | + redisEnterpriseCluster: |
| 84 | + name: rec |
| 85 | + memorySize: 1GB |
| 86 | + shardCount: 1 |
| 87 | + replication: false |
| 88 | + |
| 89 | + # Configure modules |
| 90 | + modulesList: |
| 91 | + - name: search |
| 92 | + config: "MAXSEARCHRESULTS 10000 MAXAGGREGATERESULTS 10000" |
| 93 | + - name: ReJSON |
| 94 | +``` |
| 95 | +
|
| 96 | +### Database with multiple modules |
| 97 | +
|
| 98 | +The following example shows a database configured with multiple modules: |
| 99 | +
|
| 100 | +```yaml |
| 101 | +apiVersion: app.redislabs.com/v1alpha1 |
| 102 | +kind: RedisEnterpriseDatabase |
| 103 | +metadata: |
| 104 | + name: multi-module-db |
| 105 | + labels: |
| 106 | + app: redis-enterprise |
| 107 | +spec: |
| 108 | + redisEnterpriseCluster: |
| 109 | + name: rec |
| 110 | + memorySize: 2GB |
| 111 | + shardCount: 2 |
| 112 | + replication: true |
| 113 | + |
| 114 | + modulesList: |
| 115 | + - name: search |
| 116 | + config: "MAXSEARCHRESULTS 50000" |
| 117 | + - name: ReJSON |
| 118 | + - name: timeseries |
| 119 | + config: "RETENTION_POLICY 86400000" |
| 120 | + - name: bf |
| 121 | +``` |
| 122 | +
|
| 123 | +### Active-Active database with modules |
| 124 | +
|
| 125 | +For Active-Active databases, you must specify modules with explicit versions: |
| 126 | +
|
| 127 | +```yaml |
| 128 | +apiVersion: app.redislabs.com/v1alpha1 |
| 129 | +kind: RedisEnterpriseActiveActiveDatabase |
| 130 | +metadata: |
| 131 | + name: aa-search-db |
| 132 | + labels: |
| 133 | + app: redis-enterprise |
| 134 | +spec: |
| 135 | + participatingClusters: |
| 136 | + - name: cluster-east |
| 137 | + - name: cluster-west |
| 138 | + |
| 139 | + redisEnterpriseDatabase: |
| 140 | + memorySize: 1GB |
| 141 | + shardCount: 1 |
| 142 | + replication: true |
| 143 | + |
| 144 | + modulesList: |
| 145 | + - name: search |
| 146 | + version: "2.8.4" |
| 147 | + config: "MAXSEARCHRESULTS 10000" |
| 148 | + - name: ReJSON |
| 149 | + version: "2.6.6" |
| 150 | +``` |
| 151 | +
|
| 152 | +## Module configuration |
| 153 | +
|
| 154 | +### Module parameters |
| 155 | +
|
| 156 | +Each module in the `modulesList` supports the following fields: |
| 157 | + |
| 158 | +- **name** (required): The module name (for example, "search", "ReJSON") |
| 159 | +- **version** (optional for REDB, required for REAADB): Specific module version |
| 160 | +- **config** (optional): Module-specific configuration parameters |
| 161 | + |
| 162 | +### Common module configurations |
| 163 | + |
| 164 | +#### RediSearch |
| 165 | + |
| 166 | +```yaml |
| 167 | +- name: search |
| 168 | + config: "MAXSEARCHRESULTS 10000 MAXAGGREGATERESULTS 5000 TIMEOUT 500" |
| 169 | +``` |
| 170 | + |
| 171 | +#### RedisTimeSeries |
| 172 | + |
| 173 | +```yaml |
| 174 | +- name: timeseries |
| 175 | + config: "RETENTION_POLICY 86400000 MAX_SAMPLE_PER_CHUNK 360" |
| 176 | +``` |
| 177 | + |
| 178 | +#### RedisBloom |
| 179 | + |
| 180 | +```yaml |
| 181 | +- name: bf |
| 182 | + config: "ERROR_RATE 0.01 INITIAL_SIZE 1000" |
| 183 | +``` |
| 184 | + |
| 185 | +## Best practices |
| 186 | + |
| 187 | +### Module version management |
| 188 | + |
| 189 | +- For production environments, specify explicit module versions in Active-Active databases |
| 190 | +- Use the cluster's available modules list to ensure compatibility |
| 191 | +- Test module upgrades in non-production environments first |
| 192 | + |
| 193 | +### Resource planning |
| 194 | + |
| 195 | +- Modules consume additional memory and CPU resources |
| 196 | +- Plan cluster resources accordingly when using multiple modules |
| 197 | +- Monitor module-specific metrics and performance |
| 198 | + |
| 199 | +### Configuration management |
| 200 | + |
| 201 | +- Use module configuration parameters to optimize performance |
| 202 | +- Document module configurations for consistency across environments |
| 203 | +- Consider module-specific backup and recovery requirements |
| 204 | + |
| 205 | +### Upgrade considerations |
| 206 | + |
| 207 | +- Ensure compatible module versions before cluster upgrades |
| 208 | +- Upload required module versions before upgrading the cluster |
| 209 | +- Review module compatibility matrices in Redis Enterprise documentation |
| 210 | + |
| 211 | +## Troubleshooting |
| 212 | + |
| 213 | +### Common issues |
| 214 | + |
| 215 | +1. **Module not available error:** |
| 216 | + - Check if the module is installed: `kubectl get rec <cluster-name> -o jsonpath='{.status.modules}'` |
| 217 | + - Upload the module if missing using the API endpoint |
| 218 | + |
| 219 | +2. **Version compatibility issues:** |
| 220 | + - Verify module version compatibility with your Redis Enterprise version |
| 221 | + - Check the Redis Enterprise documentation for supported module versions |
| 222 | + |
| 223 | +3. **Configuration errors:** |
| 224 | + - Validate module configuration parameters |
| 225 | + - Check Redis Enterprise logs for specific error messages |
| 226 | + |
| 227 | +### Debugging commands |
| 228 | + |
| 229 | +```bash |
| 230 | +# Check cluster status and available modules |
| 231 | +kubectl get rec <cluster-name> -o yaml |
| 232 | +
|
| 233 | +# Check database status |
| 234 | +kubectl get redb <database-name> -o yaml |
| 235 | +
|
| 236 | +# View operator logs |
| 237 | +kubectl logs -l name=redis-enterprise-operator |
| 238 | +
|
| 239 | +# Check cluster logs |
| 240 | +kubectl logs <cluster-pod-name> |
| 241 | +``` |
| 242 | + |
| 243 | +## Examples |
| 244 | + |
| 245 | +See the `deploy/examples/` directory for additional configuration examples: |
| 246 | + |
| 247 | +- Basic database: `deploy/examples/v1alpha1/redb.yaml` |
| 248 | +- Active-Active database: `deploy/examples/v1alpha1/reaadb.yaml` |
| 249 | + |
| 250 | +## Related information |
| 251 | + |
| 252 | +- [Database controller]({{< relref "/operate/kubernetes/re-databases/db-controller" >}}) - Learn how to create and manage Redis Enterprise databases |
| 253 | +- [Active-Active databases]({{< relref "/operate/kubernetes/active-active" >}}) - Set up globally distributed Active-Active databases |
| 254 | +- [Database connectivity]({{< relref "/operate/kubernetes/networking/database-connectivity" >}}) - Connect applications to your Redis Enterprise databases |
| 255 | +- [REDB API reference]({{< relref "/operate/kubernetes/reference/api/redis_enterprise_database_api" >}}) - Complete API specification for REDB resources |
| 256 | +- [REAADB API reference]({{< relref "/operate/kubernetes/reference/api/redis_enterprise_active_active_database_api" >}}) - API reference for Active-Active databases |
| 257 | +- [Redis modules documentation](https://redis.io/docs/latest/develop/reference/modules/) - Official Redis modules documentation |
0 commit comments