Azure 表与 Azure 上的 MongoDB
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7989465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Azure Table Vs MongoDB on Azure
提问by Shiju
I want to use a NoSQL database on Windows Azure and the data volume will be very large. Whether a Azure Table storage or a MongoDB database running using a Worker role can offer better performance and scalability? Has anyone used MongoDB on Azure using a Worker role? Please share your thoughts on using MongoDB on Azure over the Azure table storage.
我想在 Windows Azure 上使用 NoSQL 数据库,数据量会非常大。使用 Worker 角色运行的 Azure 表存储或 MongoDB 数据库是否可以提供更好的性能和可扩展性?有没有人使用 Worker 角色在 Azure 上使用过 MongoDB?请分享您对通过 Azure 表存储在 Azure 上使用 MongoDB 的想法。
回答by David Makogon
Table Storage is a core Windows Azure storage feature, designed to be scalable (100TB200TB500TB per account), durable (triple-replicated in the data center, optionally georeplicated to another data center), and schemaless (each row may contain any properties you want). A row is located by partition key + row key, providing very fast lookup. All Table Storage access is via a well-defined REST API usable through any language (with SDKs, built on top of the REST APIs, already in place for .NET, PHP, Java, Python & Ruby).
表存储是 Windows Azure 的一项核心存储功能,设计为可扩展(每个帐户100TB 200TB500TB)、持久(在数据中心进行三次复制,可选择地理复制到另一个数据中心)和无模式(每行可能包含您的任何属性)想)。一行通过分区键+行键定位,提供非常快速的查找。所有表存储访问都是通过定义明确的 REST API 进行的,可通过任何语言使用(使用 SDK,构建在 REST API 之上,已经适用于 .NET、PHP、Java、Python 和 Ruby)。
MongoDB is a document-oriented database. To run it in Azure, you need to install MongoDB onto a web/worker roles or Virtual Machine, point it to a cloud drive (thereby providing a drive letter) or attached disk (for Windows/Linux Virtual Machines), optionally turn on journaling (which I'd recommend), and optionally define an external endpoint for your use (or access it via virtual network). The Cloud Drive / attached disk, by the way, is actually stored in an Azure Blob, giving you the same durability and georeplication as Azure Tables.
MongoDB 是一个面向文档的数据库。要在 Azure 中运行它,您需要将 MongoDB 安装到 web/worker 角色或虚拟机上,将其指向云驱动器(从而提供驱动器号)或附加磁盘(对于 Windows/Linux 虚拟机),可选择打开日记功能(我推荐),并可选择定义一个外部端点供您使用(或通过虚拟网络访问它)。顺便说一下,云驱动器/附加磁盘实际上存储在 Azure Blob 中,为您提供与 Azure 表相同的持久性和地理复制。
When comparing the two, remember that Table Storage is Storage-as-a-Service: you simply access a well-known REST endpoint. With MongoDB, you're responsible for maintaining the database (e.g. whenever MongoDB Inc (formerly 10gen) pushes out a new version of MongoDB, you'll need to update your server accordingly).
比较两者时,请记住表存储是存储即服务:您只需访问一个众所周知的 REST 端点。使用 MongoDB,您负责维护数据库(例如,每当 MongoDB Inc(前身为 10gen)推出新版本的 MongoDB 时,您都需要相应地更新您的服务器)。
Regarding MongoDB Inc's alpha version pointed to by jtoberon: If you take a close look at it, you'll see a few key things:
关于 jtoberon 指出的 MongoDB Inc 的 alpha 版本:如果你仔细看看它,你会看到一些关键的东西:
- The setup is for a Standalone mongodb instance, without replica-sets or shards. Regarding replica-sets, you still get several benefits using the Standalone version, due to the way Blob storage works.
- To provide high-availability, you can run with multiple instances. In this case, only one instance serves the database, and one is a 'warm-standby' that launches the mongod process as soon as the other instance fails (for maintenance reboot, hardware failure, etc.).
- 该设置适用于独立的 mongodb 实例,没有副本集或分片。关于副本集,由于 Blob 存储的工作方式,使用 Standalone 版本仍然可以获得一些好处。
- 为了提供高可用性,您可以运行多个实例。在这种情况下,只有一个实例为数据库提供服务,一个是“热备份”,一旦另一个实例出现故障(用于维护重启、硬件故障等),它就会启动 mongod 进程。
While 10gen's Windows Azure wrapper is still considered 'alpha,' mongod.exe is not. You can launch the mongod exe just like you'd launch any other Windows exe. It's just the management code around the launching, and that's what the alpa implementation is demonstrating.
虽然 10gen 的 Windows Azure 包装器仍被视为“alpha”,但 mongod.exe 不是。您可以像启动任何其他 Windows exe 一样启动 mongod exe。这只是围绕启动的管理代码,这就是 alpa 实现所展示的内容。
EDIT 2011-12-8: This is no longer in an alpha state. You can download the latest MongoDB+Windows Azure project here, which provides replica-set support.
编辑 2011-12-8:这不再处于 alpha 状态。您可以在此处下载最新的 MongoDB+Windows Azure 项目,该项目提供副本集支持。
For performance, I think you'll need to do some benchmarking. Having said that, consider the following:
对于性能,我认为您需要进行一些基准测试。话虽如此,请考虑以下几点:
- When accessing either Table Storage or MongoDB from, say, a Web Role, you're still reaching out to the Windows Azure Storage system.
- MongoDB uses lots of memory for its own cache. For this reason, lots of high-scale MongoDB systems are deployed to larger instance sizes. For Table Storage access, you won't have the same memory-size consideration.
- 例如,从 Web 角色访问表存储或 MongoDB 时,您仍然需要访问 Windows Azure 存储系统。
- MongoDB 为其自己的缓存使用大量内存。出于这个原因,许多大规模的 MongoDB 系统被部署到更大的实例大小。对于表存储访问,您不会有相同的内存大小考虑。
EDIT April 7, 2015If you want to use a document-based database as-a-service, Azure now offers DocumentDB.
编辑 2015 年 4 月 7 日如果您想使用基于文档的数据库即服务,Azure 现在提供 DocumentDB。
回答by pierrecouzy
I have used both.
我两个都用过。
Azure Tables : dead simple, fast, really hard to write even simple queries.
Azure 表:非常简单、快速,即使是简单的查询也很难编写。
Mongo : runs nicely, lots of querying capabilities, requires several instances to be reliable.
Mongo :运行良好,具有大量查询功能,需要多个实例才能可靠。
In a nutshell, if your queries are really simple (key->value), you must run a cost comparison (mainly number of transactions against the storage versus cost of hosting Mongo on Azure). I would rather go to table storage for that one. If you need more elaborate queries and don't want to go to SQL Azure, Mongo is likely your best bet.
简而言之,如果您的查询非常简单(键-> 值),您必须运行成本比较(主要是针对存储的事务数与在 Azure 上托管 Mongo 的成本)。我宁愿去表存储。如果您需要更复杂的查询并且不想使用 SQL Azure,Mongo 可能是您最好的选择。
回答by kalyanswaroop
I realize that this question is dated. I'd like to add the following info for those who may come upon this question in their searches.
我意识到这个问题已经过时了。我想为那些可能在搜索中遇到这个问题的人添加以下信息。
Note that now, MongoDB is offered as a fully managed service on Azure. (officially in Beta as of Apr '15)
请注意,现在 MongoDB 作为 Azure 上的完全托管服务提供。(截至 2015 年 4 月正式处于 Beta 版)
See: http://www.mongodb.com/partners/cloud/microsoftor https://azure.microsoft.com/en-us/blog/announcing-new-mongodb-instances-on-microsoft-azure/
请参阅:http: //www.mongodb.com/partners/cloud/microsoft或 https://azure.microsoft.com/en-us/blog/announcing-new-mongodb-instances-on-microsoft-azure/
See (including pricing): https://azure.microsoft.com/en-us/marketplace/partners/mongolab/mongolab/
请参阅(包括定价):https: //azure.microsoft.com/en-us/marketplace/partners/mongolab/mongolab/
回答by Valentin Petkov
My first choice is AzureTables because SAAS model and low cost and SLA 99.99%
http://alexandrebrisebois.wordpress.com/2013/07/09/what-if-20000-windows-azure-storage-transactions-per-second-isnt-enough/
我的第一选择是 AzureTables 因为 SAAS 模型和低成本和 SLA 99.99%
http://alexandrebrisebois.wordpress.com/2013/07/09/what-if-20000-windows-azure-storage-transactions-per-second-isnt -足够的/
some limits..
http://msdn.microsoft.com/en-us/library/windowsazure/jj553018.aspx
一些限制..
http://msdn.microsoft.com/en-us/library/windowsazure/jj553018.aspx
http://www.windowsazure.com/en-us/pricing/calculator/?scenario=data-management
http://www.windowsazure.com/en-us/pricing/calculator/?scenario=data-management
or AzureSQL for small business
或适用于小型企业的 AzureSQL
DocumentDB http://azure.microsoft.com/en-us/documentation/services/documentdb/http://azure.microsoft.com/en-us/documentation/articles/documentdb-limits/
DocumentDB http://azure.microsoft.com/en-us/documentation/services/documentdb/ http://azure.microsoft.com/en-us/documentation/articles/documentdb-limits/
second choice is many cloud providers including Amazon offer S3
第二选择是包括亚马逊在内的许多云提供商提供 S3
or Google tables https://developers.google.com/bigquery/pricing
或谷歌表https://developers.google.com/bigquery/pricing
nTH choice manage the SHOW all by myself have no sleep MongoDB well I will look again the first two SAAS
nTH选择自己管理SHOW没有睡觉MongoDB很好我会再看前两个SAAS
My choice if I am running "CLOUD" I will go for SAAS model as much as possible "RENT-IT"...
如果我运行“CLOUD”,我会选择尽可能多的 SAAS 模型“RENT-IT”...
The question is what my app needs is it AzureTables or DocumentDB or AzureSQL
DocumentDB documentation
http://azure.microsoft.com/en-us/documentation/services/documentdb/
问题是我的应用需要什么 AzureTables 或 DocumentDB 或 AzureSQL
DocumentDB 文档
http://azure.microsoft.com/en-us/documentation/services/documentdb/
How Azure pricing works http://azure.microsoft.com/en-us/pricing/details/documentdb/
Azure 定价的工作原理 http://azure.microsoft.com/en-us/pricing/details/documentdb/
this is fun http://www.documentdb.com/sql/demo
回答by Phil
At Build 2016 it was announced that DocumentDB would support all MongoDB drivers. This solves some of the lack of tooling issues with DocDB and also makes it easier to migrate Mongo apps.
在 Build 2016 上宣布 DocumentDB 将支持所有 MongoDB 驱动程序。这解决了 DocDB 缺少工具的一些问题,也使迁移 Mongo 应用程序变得更加容易。
回答by Jason Hogg - MSFT
Above answers are all good - but the real answer depends on what your requirements are. You need to understand what size of data you are processing, what types of operations you want to perform on the data and then select the solution that meets your needs.
以上答案都很好-但真正的答案取决于您的要求。您需要了解您正在处理的数据大小,您希望对数据执行哪些类型的操作,然后选择满足您需求的解决方案。
回答by Saisurya Kattamuri
One thing to remember is Azure Table Storage doesn't support complex data types.It supports every property in entity to be a String or number or boolean or date etc. One can't store an object against a key,which i feel is must for NoSql DB. https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/understanding-the-table-service-data-modelscroll to Property Types
要记住的一件事是 Azure 表存储不支持复杂的数据类型。它支持实体中的每个属性都是字符串或数字或布尔值或日期等。不能根据键存储对象,我觉得这是必须的用于 NoSql 数据库。 https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/understanding-the-table-service-data-model滚动到属性类型