redis-sentinel
Version, currently master branch1 version
- master branchlatestSep 13, 2019
github.com/pgeraghty/redis-sentinel-crystal
Redis Sentinel support for Crystal
Installation
# Add this to your shard.yml
dependencies:
redis-sentinel:
github: pgeraghty/redis-sentinel-crystal
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Paul Geraghty
Dependencies
Runtime Dependencies
- redis~> 2.2.1github: pgeraghty/crystal-redis, branch: pipeline_multi
README
Redis Sentinel for Crystal
Basic Redis Sentinel support for Crystal. Ported directly from the Ruby Redis gem.
Installation
-
Add the dependency to your
shard.yml:dependencies: redis-sentinel: github: pgeraghty/redis-sentinel-crystal -
Run
shards install
Usage
require "redis-sentinel"
Given the environment established via the example Redis 4 Docker Compose file, the following should execute successfully:
r = Redis.new host: "the-master", password: "abc", sentinels: [{:host => "172.22.0.15", :port => 26379}, {:host => "172.22.0.20", :port => 26379}]
Due to the implementation monkey-patching the base Redis shard, you can also use Redis::PooledClient with the arguments above.
Redis version 5.0.1 and above support password protection for Sentinel instances (in addition to the underlying Redis infrastructure) if they are configured with the "requirepass" directive (as per this commit). To configure this in the client, you simply add a password to the hash, so to connect to the Sentinel instances established in the example Redis 5 Docker Compose file, you'd use:
r = Redis.new host: "the-master", password: "abc", sentinels: [{:host => "172.21.0.15", :port => 26379, :password => "abcd"}, {:host => "172.21.0.20", :port => 26379, :password => "abcd"}]
Development
Testing and development require a functional Redis Sentinel configuration; I have provided Docker Compose files to establish these for Redis 4 or 5. Both set up a separate static network so that IP addresses are pre-established.
TODO experiment with SSL configuration in conjunction with Client.from_hash.
Contributing
- Fork it (https://github.com/pgeraghty/redis-sentinel-crystal/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Paul Geraghty - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Sep 13, 2019
- Indexed
- yes
Dependents
Repository
github.com/pgeraghty/redis-sentinel-crystal
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 18, 2026
- Synced
- Aug 18, 2026
- Versions
- 1