Skip to content

feat: add redis sentinel support#6255

Open
ruanimal wants to merge 1 commit into
QuantumNous:mainfrom
ruanimal:up_main
Open

feat: add redis sentinel support#6255
ruanimal wants to merge 1 commit into
QuantumNous:mainfrom
ruanimal:up_main

Conversation

@ruanimal

@ruanimal ruanimal commented Jul 17, 2026

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

增加 redis 哨兵支持

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

  • Closes # (如有)

✅ 提交前检查项 / Checklist

  • 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • 变更理解: 我已理解这些更改的工作原理及可能影响。
  • 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)

Summary by CodeRabbit

  • New Features

    • Added support for connecting to Redis through Sentinel for improved availability.
    • Added configuration options for Sentinel addresses, master name, authentication, password, and database selection.
    • Redis can now be disabled when neither standalone nor Sentinel configuration is provided.
  • Documentation

    • Updated the environment configuration example with guidance on standalone and Sentinel modes.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bcbfea46-5637-448a-91cc-421cb9d1f935

📥 Commits

Reviewing files that changed from the base of the PR and between a63364d and 405d3c3.

📒 Files selected for processing (2)
  • .env.example
  • common/redis.go

Walkthrough

Redis initialization now supports standalone and Redis Sentinel modes. The example environment file documents Sentinel addresses, master name, credentials, database, and pool-related settings, while the Redis client selects and configures the appropriate connection mode.

Changes

Redis Sentinel support

Layer / File(s) Summary
Redis mode configuration and routing
.env.example, common/redis.go
Redis environment documentation distinguishes standalone and Sentinel modes, and InitRedisClient selects the client mode based on configured variables.
Sentinel failover client construction
common/redis.go
Sentinel addresses are parsed and combined with master name, credentials, database, and pool settings to create a Redis failover client.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant InitRedisClient
  participant initRedisSentinel
  participant RedisSentinel
  Environment->>InitRedisClient: Provide Redis and Sentinel settings
  InitRedisClient->>initRedisSentinel: Select Sentinel mode
  initRedisSentinel->>RedisSentinel: Build failover client options
  RedisSentinel-->>InitRedisClient: Return configured Redis client
Loading

Suggested reviewers: calcium-ion

Poem

A rabbit hops through Sentinel’s glow,
Finding Redis masters in a row.
Addresses split, credentials align,
Failover clients now work just fine.
“Hop-hop!” says Bun, “the cache can go!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding Redis Sentinel support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant