Skip to content

feat(redis): support redis sentinel mode #2381#5438

Open
kayoch1n wants to merge 6 commits intozeromicro:masterfrom
kayoch1n:feat/redis-sentinel
Open

feat(redis): support redis sentinel mode #2381#5438
kayoch1n wants to merge 6 commits intozeromicro:masterfrom
kayoch1n:feat/redis-sentinel

Conversation

@kayoch1n
Copy link

@kayoch1n kayoch1n commented Feb 21, 2026

Issue #2381

This PR introduces Redis Sentinel support in go-zero by leveraging redis.NewFailoverClient from go-redis/v9, enabling high availability without requiring Redis Cluster.

Key changes:

  • Added new SentinelType constant to distinguish Sentinel mode
  • Updated client creation logic to use NewFailoverClient when Type: SentinelType
  • Configuration now accepts comma-separated Sentinel addresses in Host and requires MasterName
  • Added unit tests for Sentinel client initialization

Example usage:

	c := redis.MustNewRedis(redis.RedisConf{
		Type: redis.SentinelType,
		Host: strings.Join([]string{
			"10.244.2.24:26379", // the addresses of sentinel instances
			"10.244.1.15:26379",
			"10.244.2.26:26379",
		}, ","),
		MasterName: "mymaster",
	})

The returned *redis.Client remains fully compatible with the existing RedisNode interface.

@kayoch1n
Copy link
Author

kayoch1n commented Mar 2, 2026

Hi, @kevwan would you be pleased to have a look on this?

@kayoch1n kayoch1n changed the title feat: support redis sentinel mode #2381 feat(redis): support redis sentinel mode #2381 Mar 3, 2026
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