Prerequisites
- Redis version ≥ 6.0
- A Redis user with sufficient privileges to read data and manage keyspace notifications
- Keyspace notifications enabled for change data capture
Redis Setup
1. Grant Database Access
- Configure one of the Connection Options to ensure Streamkap can reach your Redis instance.
2. Enable Keyspace Notifications
Keyspace notifications allow clients to receive events affecting the Redis data set in some way. The Connector relies on Redis keyspace notifications for capturing changes. Set the following parameter in your Redis configuration:notify-keyspace-events = KEA
- K: Keyspace events, published with
__keyspace@<db>__prefix - E: Keyevent events, published with
__keyevent@<db>__prefix - A: Alias for all event types (g$lshzxe)
Keyspace notifications and performanceEnabling keyspace notifications may impact Redis performance, especially in high-throughput environments. Monitor your Redis instance after enabling this feature.
- Configure notifications for specific event types if full coverage isn’t needed.
- Monitor memory usage and CPU utilization.
- Consider using a dedicated Redis instance for CDC if performance becomes an issue.
3. Create Database User
It’s recommended to create a separate user for the Connector to access your Redis instance. Below is an example that creates a user with appropriate permissions.on: Activates the user>{password}: Sets the password~*: Allows access to all keys+@read: Allows all read commands+@connection: Allows connection-related commands+config|get: Allows CONFIG GET command for verification
Redis ACL compatibilityACL support requires Redis 6.0 or higher. For earlier versions, you can use the
requirepass setting in redis.conf for password authentication, though this provides less granular access control.4. Connection Details
You’ll need the following information for the Streamkap Setup:- Hostname/IP: The Redis server hostname or IP address
- Port: Default is
6379 - Database: Redis database number (0-15 by default)
- Username: The username created above (if using ACL)
- Password: The password for the user
TLS/SSL ConnectionsIf your Redis instance requires TLS/SSL, ensure you have:
- Valid certificates
- The correct hostname that matches the certificate
- TLS enabled on your Redis instance
Streamkap Setup
Follow these steps to configure your new connector:1. Create the Source
- Navigate to Add Connectors.
- Choose Redis.
2. Connection Settings
- Name: Enter a name for your connector.
-
Redis Type: Choose the type of Redis deployment:
- Standalone: Single Redis instance
- Cluster: Redis Cluster deployment
- Hostname: Specify the hostname or IP address of your Redis server.
-
Port: Default is
6379. - Database: Specify the Redis database number to stream data from (0-15 by default).
-
Connect via SSH Tunnel: The Connector will connect to an SSH server in your network which has access to your Redis instance. This is necessary if the Connector cannot connect directly to your database.
- See SSH Tunnel for setup instructions.
-
Username: Username to access Redis. By default, Streamkap scripts use
streamkap_user.- Leave empty for Redis versions < 6.0 without ACL support.
- Password: Password to access the Redis instance.
- Enable TLS?: Whether to use an encrypted TLS/SSL connection to the Redis server.
- Allow Insecure Connections?: Allow connections with invalid or self-signed certificates (not recommended for production).
3. Advanced Parameters
-
Batch Size: Number of keys to process in a single batch. Default is
1000.- Adjust based on your Redis instance’s performance and network capacity.
-
Poll Interval (ms): How frequently to poll Redis for changes. Default is
100.- Lower values provide near real-time CDC but increase load on Redis.
Data Capture
The Redis Source Connector captures changes to Redis keys and publishes them to Kafka topics. Each change event includes:- Key: The Redis key that changed
- Operation: The type of operation (set, delete, expire, etc.)
- Value: The current value (for set operations)
- Timestamp: When the change occurred
Topic Naming
By default, topics are named based on the Redis database:- Pattern:
redis_db_{database_number} - Example:
redis_db_0for database 0
Supported Redis Data Types
The connector supports the following Redis data types:- String: Simple key-value pairs
- Hash: Hash maps
- List: Ordered lists
- Set: Unordered sets
- Sorted Set: Ordered sets with scores
- Stream: Redis Streams (if using Stream Source mode)
Troubleshooting
No events are being captured
No events are being captured
Verify that keyspace notifications are enabled:
The response should include
KEA or the specific event types you need. If not, enable them as described in Enable Keyspace Notifications.Authentication failures
Authentication failures
If you’re experiencing authentication issues:
- Verify the username and password are correct
- For Redis 6.0+, ensure the user has appropriate ACL permissions
- Check if
requirepassis set in redis.conf for Redis versions < 6.0 - Verify network connectivity and firewall rules
Performance impact on Redis
Performance impact on Redis
If Redis performance degrades after enabling CDC:
- Reduce the batch size to lower per-batch load
- Increase the poll interval to reduce polling frequency
- Monitor Redis metrics (CPU, memory, network I/O)
- Consider using a dedicated Redis replica for CDC
- Limit keyspace notifications to specific event types instead of using
KEA
Missing change events
Missing change events
If you’re not capturing all expected changes:
- Verify keyspace notifications include all necessary event types
- Check that the connector is running and connected
- Review connector logs for errors or warnings
- Ensure the Redis user has permissions to read all keys
- Verify the database number is correct in the configuration