提交 33e44fc9 编写于 作者: 黄孟柱

删除redis 哨兵模式

上级 5bf33d81
......@@ -2,7 +2,7 @@ package redis_manager
import (
"fmt"
"github.com/eolinker/goku/common/redis"
"github.com/go-redis/redis"
"sort"
)
......@@ -29,21 +29,7 @@ func Create(config RedisConfig) Redis {
config: config,
}
}
case RedisModeSentinel:
{
option := redis.SentinelRingOptions{
Addrs: config.GetAddrs(),
Masters: config.GetMasters(),
Password: config.GetPassword(),
DB: config.GetDbIndex(),
PoolSize: _PoolSize,
}
return &redisProxy{
Cmdable: redis.NewSentinelRing(&option),
config: config,
}
}
case RedisModeStand:
{
......
package redis_manager
import (
"github.com/eolinker/goku/common/redis"
"github.com/go-redis/redis"
)
type redisProxy struct {
......@@ -27,18 +27,7 @@ func (p *redisProxy) Nodes() []string {
}(ch)
}
case RedisModeSentinel:
{
conn := p.Cmdable.(*redis.SentinelRing)
go func(ch chan string ) {
conn.ForEachAddr(func(addr string) error {
ch<-addr
return nil
})
close(ch)
}(ch)
}
case RedisModeStand:
{
......@@ -68,12 +57,7 @@ func (p *redisProxy) Foreach(fn func(client *redis.Client) error) error {
conn := p.Cmdable.(*redis.ClusterClient)
return conn.ForEachMaster(fn)
}
case RedisModeSentinel:
{
conn := p.Cmdable.(*redis.SentinelRing)
return conn.ForEachShard(fn)
}
case RedisModeStand:
{
......
package redis_manager
import "github.com/eolinker/goku/common/redis"
import "github.com/go-redis/redis"
const (
RedisModeCluster = "cluster"
RedisModeSentinel = "sentinel"
RedisModeStand = "stand"
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册