Skip to main content
Integrations to extend Prefect’s functionality with Redis.

Getting started

Install prefect-redis

The following command will install a version of prefect-redis compatible with your installed version of prefect. If you don’t already have prefect installed, it will install the newest version of prefect as well.
Upgrade to the latest versions of prefect and prefect-redis:

Register newly installed block types

Register the block types in the prefect-redis module to make them available for use.

Connecting with a URL (including Redis Sentinel)

Every prefect-redis connection point — the server messaging client, the worker cleanup queue, the RedisLockManager, and the RedisDatabase block — accepts a full connection URL in addition to the individual host/port/db/username/password/ssl fields. When a URL is provided it is authoritative and the scalar fields are ignored. The following schemes are supported: The Sentinel schemes accept a comma-separated list of Sentinel members and a master group name, and the resulting client resolves the current master through the Sentinel daemons and follows failover automatically:
The sentinel_username and sentinel_password query parameters configure authentication to the Sentinel daemons separately from the data nodes. All other query parameters are treated as standard redis-py connection options (socket_timeout, max_connections, health_check_interval, …) and apply to the data-node connections. On the rediss+sentinel:// scheme the ssl_* options also apply to the Sentinel daemon connections, so a single private CA works for the whole topology, e.g. rediss+sentinel://sentinel-a:26379,sentinel-b:26379/mymaster?ssl_ca_certs=/etc/redis/ca.pem. Query options take precedence over the equivalent Prefect settings (for example PREFECT_REDIS_MESSAGING_SOCKET_TIMEOUT), just as they do with redis-py’s Redis.from_url.

Server messaging and worker cleanup queue

Point the Prefect server’s Redis messaging and its worker cleanup queue at a Sentinel topology with one URL per subsystem:
Both settings also accept single-node redis:// / rediss:// URLs.

Lock manager

RedisDatabase block

Resources

Refer to the SDK documentation to explore all the capabilities of prefect-redis.