多个Redis数据库有什么意义? [英] What's the Point of Multiple Redis Databases?

查看:53
本文介绍了多个Redis数据库有什么意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我想将存储在 redis 中的数据分割成单独的数据库,因为有时我需要对一种特定类型的数据使用 keys 命令,并希望将其分离为让它更快.

So, I've come to a place where I wanted to segment the data I store in redis into separate databases as I sometimes need to make use of the keys command on one specific kind of data, and wanted to separate it to make that faster.

如果我分割成多个数据库,一切仍然是单线程的,我仍然只能使用一个核心.如果我只是在同一个盒子上启动另一个 Redis 实例,我就可以使用一个额外的核心.最重要的是,我无法命名 Redis 数据库,也无法为它们提供任何更符合逻辑的标识符.那么,综上所述,为什么/何时我会想要使用多个 Redis 数据库,而不是仅仅为我想要的每个额外数据库启动一个额外的 Redis 实例?与此相关的是,为什么 Redis 不尝试为我添加的每个额外数据库使用一个额外的核心?跨数据库单线程有什么好处?

If I segment into multiple databases, everything is still single threaded, and I still only get to use one core. If I just launch another instance of Redis on the same box, I get to use an extra core. On top of that, I can't name Redis databases, or give them any sort of more logical identifier. So, with all of that said, why/when would I ever want to use multiple Redis databases instead of just spinning up an extra instance of Redis for each extra database I want? And relatedly, why doesn't Redis try to utilize an extra core for each extra database I add? What's the advantage of being single threaded across databases?

推荐答案

原则上,同一实例上的 Redis 数据库与 RDBMS 数据库实例中的模式没有区别.

In principal, Redis databases on the same instance are no different than schemas in RDBMS database instances.

所以,说了这么多,为什么/什么时候我会想要使用多个Redis 数据库,而不是仅仅启动一个额外的 Redis 实例对于我想要的每个额外数据库?

So, with all of that said, why/when would I ever want to use multiple Redis databases instead of just spinning up an extra instance of Redis for each extra database I want?

在同一个 redis 实例中使用 redis 数据库有一个明显的优势,那就是管理.如果您为每个应用程序启动一个单独的实例,假设您有 3 个应用程序,那就是 3 个单独的 redis 实例,每个实例在生产中可能需要一个从属用于 HA,因此总共有 6 个实例.从管理的角度来看,这会很快变得混乱,因为您需要监控所有这些,进行升级/补丁等.如果您不打算使用高 I/O 使 redis 过载,那么带有从属设备的单个实例会更简单,并且如果满足您的 SLA,则更易于管理.

There's one clear advantage of using redis databases in the same redis instance, and that's management. If you spin up a separate instance for each application, and let's say you've got 3 apps, that's 3 separate redis instances, each of which will likely need a slave for HA in production, so that's 6 total instances. From a management standpoint, this gets messy real quick because you need to monitor all of them, do upgrades/patches, etc. If you don't plan on overloading redis with high I/O, a single instance with a slave is simpler and easier to manage provided it meets your SLA.

这篇关于多个Redis数据库有什么意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆