duangaoe9401 2019-04-26 07:57
浏览 349

Redis集群与数据库的索引有何关系?

The code below is written in Go, but the problem itself relates to Redis.

Previously our code looked like the following:

c := redis.NewClient(
    &redis.Options{
        Addr: addr, 
        Password: pass, 
        DB: db,
    },
) 

But it was refactored to:

clusterSlots := func() ([]redis.ClusterSlot, error) {
    slots := []redis.ClusterSlot{
        {
            Start: 0,
            End:   16383,
            Nodes: []redis.ClusterNode{{
                    Addr: masterAddr,
                }, {
                    Addr: slaveAddr, 
                }},
        },
    }
    return slots, nil
}

rediscli := redis.NewClusterClient(&redis.ClusterOptions{
    ClusterSlots:  clusterSlots,
    RouteRandomly: true,
    Password:      pass,
})

And due to my level of understanding the overall Redis ideas, I don't quite understand, how does cluster relate to DB. Will it look through each of DB, with the index of zero nor any of variants?

Unfortunately, I have not enough time to dive in deeply.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 机器学习教材中的例题询问
    • ¥15 求.net core 几款免费的pdf编辑器
    • ¥20 SQL server表计算问题
    • ¥15 C# P/Invoke的效率问题
    • ¥20 thinkphp适配人大金仓问题
    • ¥20 Oracle替换.dbf文件后无法连接,如何解决?(相关搜索:数据库|死循环)
    • ¥15 数据库数据成问号了,前台查询正常,数据库查询是?号
    • ¥15 算法使用了tf-idf,用手肘图确定k值确定不了,第四轮廓系数又太小才有0.006088746097507285,如何解决?(相关搜索:数据处理)
    • ¥15 彩灯控制电路,会的加我QQ1482956179
    • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传