Redis 作为数据库 [英] Redis as a database

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

问题描述

我想将 Redis 用作数据库,而不是缓存.根据我(有限的)理解,Redis 是一个内存数据存储.使用 Redis 有哪些风险,我该如何减轻这些风险?

I want to use Redis as a database, not a cache. From my (limited) understanding, Redis is an in-memory datastore. What are the risks of using Redis, and how can I mitigate them?

推荐答案

您可以通过多种不同方式将 Redis 用作权威存储:

You can use Redis as an authoritative store in a number of different ways:

  • 打开 AOF(仅附加文件存储)查看 AOF 文档.这将实时记录针对您的数据集执行的所有 Redis 命令.

  • Turn on AOF (Append-only File store) see AOF docs. This will keep a log of all Redis commands made against your dataset in real-time.

使用主从复制运行 Redis 查看复制文档.如果您的一个实例出现故障,这将使您能够提供高可用性.

Run Redis using Master-Slave replication see replication docs. This will allow you to provide high-availability if one of your instances fails.

如果您在 EC2 之类的设备上运行,您可以 EBS 支持您的 Redis 分区,以提供另一层防止实例故障的保护.

If you're running on something like EC2 you can EBS back your Redis partition to provide another layer of protection against instance failure.

即将到来的是 Redis Cluster - 这个专门设计用于以有助于 HA 和可扩展性的方式运行 Redis.但是,这种情况至少在六个月左右后才会出现.

On the horizon is Redis Cluster - this is specifically designed as a way to run Redis in a way that should help with HA and scalability. However, this won't appear for at least another six months or so.

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

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