嵌入式非关系型 (nosql) 数据存储

发布于 2024-08-17 23:38:41 字数 670 浏览 3 评论 0原文

我正在考虑为我的 Windows 桌面应用程序使用/实现某种嵌入式键值(或文档)存储。我希望能够存储各种类型的数据(GPS 轨迹就是一个例子),当然也能够查询这些数据。数据量大到无法同时加载到内存中。

我正在考虑使用 sqlite 作为键值存储的存储引擎,例如 y-serial,但用 .NET 编写。我还阅读了FriendFeed 使用 MySQL 来存储无架构数据,这是关于如何使用 RDBMS 处理非关系数据的一个很好的指南。 sqlite 似乎是一个不错的选择,因为它的简单性、可移植性和库大小。

我的问题是嵌入式非关系存储是否还有其他选择?它不需要是可分发的,也不需要支持事务,但它必须可以从 .NET 访问,并且下载大小应该较小。

更新:我发现一篇题为 SQLite 作为键值数据库 的文章将 sqlite 与 Berkeley DB 进行比较,Berkeley DB 是一个嵌入式键值存储库。

I'm thinking about using/implementing some kind of an embedded key-value (or document) store for my Windows desktop application. I want to be able to store various types of data (GPS tracks would be one example) and of course be able to query this data. The amount of data would be such that it couldn't all be loaded into memory at the same time.

I'm thinking about using sqlite as a storage engine for a key-value store, something like y-serial, but written in .NET. I've also read about FriendFeed's usage of MySQL to store schema-less data, which is a good pointer on how to use RDBMS for non-relational data. sqlite seems to be a good option because of its simplicity, portability and library size.

My question is whether there are any other options for an embedded non-relational store? It doesn't need to be distributable and it doesn't have to support transactions, but it does have to be accessible from .NET and it should have a small download size.

UPDATE: I've found an article titled SQLite as a Key-Value Database which compares sqlite with Berkeley DB, which is an embedded key-value store library.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

小…红帽 2024-08-24 23:38:41

Windows 有一个内置的嵌入式非关系存储。它称为 ESENT,由多个 Windows 应用程序使用,包括 Active Directory 和 Windows 桌面搜索。

http://blogs.msdn.com/windowssdk/archive/2008/10/23/esent-extensible-storage-engine-api-in-the-windows-sdk.aspx

如果您想要 .NET 访问您可以使用 CodePlex 上的 ManagedEsent 层。

http://managementesent.codeplex.com/

该项目有一个 PersistentDictionary 类,它实现了一个键值存储,实现 IDictionary 接口,但由数据库支持。

Windows has a built-in embedded non-relational store. It is called ESENT and is used by several Windows applications, including the Active Directory and Windows Desktop Search.

http://blogs.msdn.com/windowssdk/archive/2008/10/23/esent-extensible-storage-engine-api-in-the-windows-sdk.aspx

If you want .NET access you can use the ManagedEsent layer on CodePlex.

http://managedesent.codeplex.com/

That project has a PersistentDictionary class that implements a key-value store that implements the IDictionary interface, but is backed by a database.

与他有关 2024-08-24 23:38:41

看看 RavenDB。它看起来好像可以嵌入、无模式并可与 .NET 一起使用

来自网站:

  • 可扩展基础架构:Raven 构建在现有的、经过验证的可扩展基础架构之上
  • 简单的 Windows 配置:Raven 易于设置并在 Windows 上运行,既可以作为服务或 IIS7 网站
  • 事务性:Raven 支持 System.Transaction 和 ACID 事务。如果您将数据放入其中,该数据将保留在那里
  • Map/Reduce:使用 Linq 查询轻松定义 Map/Reduce 索引
  • .NET 客户端 API:Raven 附带功能齐全的 .NET 客户端 API,可实现工作单元等
  • RESTful:Raven 围绕 RESTful API 构建

Take a look at RavenDB. It looks as though it can be embedded and is schemaless and works with .NET

From the website:

  • Scalable infrastructure: Raven builds on top of existing, proven and scalable infrastructure
  • Simple Windows configuration: Raven is simple to setup and run on windows as either a service or IIS7 website
  • Transactional: Raven support System.Transaction with ACID transactions. If you put data in it, that data is going to stay there
  • Map/Reduce: Easily define map/reduce indexes with Linq queries
  • .NET Client API: Raven comes with a fully functional .NET client API which implements Unit of Work and much more
  • RESTful: Raven is built around a RESTful API
離人涙 2024-08-24 23:38:41

就我个人而言,我会选择 SQLite 和 NHibernate(以及 Fluent NHibernate)。 NHibernate 可以自动为您的类生成数据库模式,因此您只需指定要保留的类,这对于 Fluent NHibernate 来说非常容易。此外,您可以搜索特定对象,而无需将所有数据加载到内存中。

Personally I would go for SQLite with NHibernate (and Fluent NHibernate). NHibernate can generate the database schema automatically for your classes, so you just need to specify what classes you want to persist, and that's quite easy with Fluent NHibernate. Furthermore, you can search for specific objects and you don't need to load all data to memory.

半衬遮猫 2024-08-24 23:38:41

将 KISS 原则应用于您的问题,我建议您使用文件。

正如文件名是关键一样。
文件内容就是值。
Windows 文件夹是索引。

简单、快速、高效、灵活、万无一失(前提是傻瓜的智力低)。

Applying the KISS principle to your problem I would recommend you use files.

As in filename is the key.
File contents is the value.
Windows folder is the index.

Simple, quick, efficient, flexible, and foolproof (providing the fools have low intelligence).

花伊自在美 2024-08-24 23:38:41

您可以创建一个包含两列的简单 sqlite 数据库吗:

==documents==
id|data

并且数据将是 json 数据。

您还可以创建一个键表,该表将是:

==keys==
keyname|keyvalue|id

将根据键名和键值建立索引以进行快速查找。

单个数据库文件可以是一个集合,并且您可以为多个集合创建多个数据库文件。

您可以使用文件夹作为“dbs”来匹配 mongodb 的 db->collection->document 层次结构

Could you create a simple sqlite database with two columns:

==documents==
id|data

and data would be json data.

You could also create a key table which would be:

==keys==
keyname|keyvalue|id

that would be indexed on keyname and keyvalue for quick lookups.

A single db file could be a collection, and you could create multiple db files for multiple collections.

You could use folders as "dbs" to match mongodb's hierarchy of db->collection->document

初雪 2024-08-24 23:38:41

这是一个老问题,但我想我应该添加一个答案,以防有人偶然发现它。我的公司刚刚发布了一个用于 .NET 平台的开源嵌入式 XML 数据库,名为 Nxdb。它采用 Apache 2.0 许可证,并已在内部开发和使用多年。它基本上是与 BaseX(一个出色的 Java XML 数据库)的交叉编译(使用 IKVM)版本的绑定,以及针对嵌入式用例和 .NET 环境的额外功能。项目页面位于:https://dracorp.assembla.com/spaces/nxdb

XML 有效对于这种类型的数据存储来说,只要您尝试存储的内容可序列化为文本,您就可以存储复杂的分层树。事实上,如果直接访问数据库,您甚至不必接触“XML”。还可以使用XQuery这种强大而完整的查询语言进行查询。

This is an old question, but I thought I'd add an answer in case anyone stumbles on it. My company just released an open source embedded XML database for the .NET platform called Nxdb. It's under the Apache 2.0 license and has been in development and use internally for several years. It's basically a binding to a cross-compiled (using IKVM) version of BaseX (a fantastic Java XML database) along with extra functionality for the embedded use case and the .NET environment. The project page is here: https://dracorp.assembla.com/spaces/nxdb

XML works well for this type of data store given that as long as the content you're trying to store is serializable to text you can store complex hierarchical trees. In fact, if you access the database directly, you don't ever even have to touch "XML". It can also be queried with XQuery, a powerful and complete query language.

想你只要分分秒秒 2024-08-24 23:38:41

感谢您提到 y_serial...更准确地说,它是一个 Python 模块:

用 SQLite 仓库 Python 对象

“序列化 + 持久化 :: 用几行代码,将 Python 对象压缩并注释到 SQLite 中;然后按时间顺序检索它们通过没有任何 SQL 的关键字来存储无模式数据的数据库最有用的“标准”模块。”

http://yserial.sourceforge.net

根据我的经验,SQLite 是比大多数数据库更快、更可靠的选择(包括 PostgresQL 和 Berkeley DB)适用于大多数项目——当然,它不需要服务器守护程序。

yserial 非常容易实现(并且比“文件名是键/文件内容是值”方法快得多;-)

Thanks for your kind mention of y_serial... more precisely, it is a Python module:

warehouse Python objects with SQLite

"Serialization + persistance :: in a few lines of code, compress and annotate Python objects into SQLite; then later retrieve them chronologically by keywords without any SQL. Most useful "standard" module for a database to store schema-less data."

http://yserial.sourceforge.net

In my experience, SQLite is a faster and more reliable choice than most databases (including PostgresQL and Berkeley DB) for the majority of projects -- and of course, it does not need a server daemon.

yserial is very easy to implement (and far faster than the "filename is the key / file contents is the value" approach ;-)

败给现实 2024-08-24 23:38:41

您可以尝试一下https://github.com/mdsoftware/mData。小,免费而且很不寻常。类似 Lisp 的数据查询语言、表达式编译器、高性能二进制序列化,全部包含在内。

You can try this one https://github.com/mdsoftware/mData. Small, free and quite unusual. Lisp-like data query language, expression compiler, high-performance binary serialization, all included.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文