hxd / redis-sentinel-switch
Redis sentinel switch, auto switch config redis standalone and sentinel
Installs: 93
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/hxd/redis-sentinel-switch
Requires
- php: ^7.1|^7.2|^7.3|^7.4|^8.0|^8.1
- predis/predis: ^2.0
Requires (Dev)
- illuminate/support: 6.x|^8.18|^9.0
This package is auto-updated.
Last update: 2025-10-01 00:11:45 UTC
README
Package dùng để tự động switch giữa redis standalone qua sentinel cho laravel.
**Nguyên lý hoạt động: **
Package này đơn giản chỉ over-write lại config mặc định của laravel để predis nhận biết được các cụm sentinel
Hướng dẫn
Cài đặt package:
composer require hxd/redis-sentinel-switch
Bạn cần config các biến môi trường sau vào .env
:
# Nếu bạn để null thì mặc định laravel sử dụng standalone REDIS_REPLICATION=sentinel #Cụm sentinel master hoặc standalone REDIS_HOST=_master_sentinel_host_ REDIS_PORT=26379 REDIS_PASSWORD= REDIS_TIMEOUT=0.1 # Cluster name REDIS_SENTINEL_SERVICE=mymaster REDIS_SENTINEL_TIMEOUT=0.1 # Các cụm Sentinel Slave REDIS_SENTINEL=tcp://slave_sentinel_1:26379,tcp://slave_sentinel_2:26379