Arangodb 简明教程
ArangoDB - A Multi-Model First Database
ArangoDB 被其开发者称为原生多模型数据库。这不同于其它 NoSQL 数据库。在此数据库中,数据可以存储为文档、键/值对或图形。并且借助单一的声明式查询语言,可以访问任意或所有数据。此外,可以在单个查询中组合不同的模型。而且,由于其多模型样式,可以制定精益应用程序,这些应用程序将使用任意或全部三种数据模型横向扩展。
ArangoDB is hailed as a native multi-model database by its developers. This is unlike other NoSQL databases. In this database, the data can be stored as documents, key/value pairs or graphs. And with a single declarative query language, any or all of your data can be accessed. Moreover, different models can be combined in a single query. And, owing to its multi-model style, one can make lean applications, which will be scalable horizontally with any or all of the three data models.
Layered vs. Native Multi-Model Databases
在本节中,我们将重点介绍原生多模型数据库与分层多模型数据库之间的关键差异。
In this section, we will highlight a crucial difference between native and layered multimodel databases.
许多数据库供应商称自己的产品为“多模型”,但向键/值或文档存储添加图形层并不能算作原生多模型。
Many database vendors call their product “multi-model,” but adding a graph layer to a key/value or document store does not qualify as native multi-model.
借助 ArangoDB,我们可以使用相同查询语言的同一内核,在一个查询中组合不同的数据模型和特性,如我们在上一节中已经指出的那样。在 ArangoDB 中,没有数据模型之间的“切换”,也不存在从 A 到 B 的数据转移来执行查询的情况。与“分层”的方法相比,这为 ArangoDB 带来了性能优势。
With ArangoDB, the same core with the same query language, one can club together different data models and features in a single query, as we have already stated in previous section. In ArangoDB, there is no “switching” between data models, and there is no shifting of data from A to B to execute queries. It leads to performance advantages to ArangoDB in comparison to the “layered” approaches.
The Need for Multimodal Database
解释 [Fowler’s] 的基本思想让我们意识到,使用各种适当的数据模型对持久层(该层是大型软件架构的一部分)的不同部分是有益的。
Interpreting the [Fowler’s] basic idea leads us to realize the benefits of using a variety of appropriate data models for different parts of the persistence layer, the layer being part of the larger software architecture.
根据这一点,例如,您可能使用关系数据库来保持结构化表格数据的持久性;使用文档存储来保持非结构化对象数据(如数据);使用键/值存储来保持哈希表的持久性;并且使用图形数据库来保持高度链接的引用数据的持久性。
According to this, one might, for example, use a relational database to persist structured, tabular data; a document store for unstructured, object-like data; a key/value store for a hash table; and a graph database for highly linked referential data.
然而,这种方法的传统实现会导致在同一项目中使用多个数据库。这会导致一些操作摩擦(更复杂的部署、更频繁的升级),以及数据一致性和重复问题。
However, traditional implementation of this approach will lead one to use multiple databases in the same project. It can lead to some operational friction (more complicated deployment, more frequent upgrades) as well as data consistency and duplication issues.
在统一三个数据模型的数据之后,下一个挑战是设计并实现一种通用查询语言,该语言允许数据管理员表达各种查询,如文档查询、键/值查找、图形查询以及这些查询的任意组合。
The next challenge after unifying the data for the three data models, is to devise and implement a common query language that can allow data administrators to express a variety of queries, such as document queries, key/value lookups, graphy queries, and arbitrary combinations of these.
graphy queries ,我们的意思是涉及图论考虑因素的查询。特别是,这些可能涉及来自边的特定连接功能。例如, ShortestPath, GraphTraversal 和 Neighbors 。
By graphy queries, we mean queries involving graph-theoretic considerations. In particular, these may involve the particular connectivity features coming from the edges. For example, ShortestPath, GraphTraversal, and Neighbors.
图形非常适合作为关系的数据模型。在许多现实世界的情况中,例如社交网络、推荐人系统等,一个非常自然的数据模型是图形。它捕捉关系,并且可以在每个边和每个顶点中包含标签信息。此外,JSON 文档非常适合存储此类型的顶点和边数据。
Graphs are a perfect fit as data model for relations. In many real-world cases such as social network, recommendor system, etc., a very natural data model is a graph. It captures relations and can hold label information with each edge and with each vertex. Further, JSON documents are a natural fit to store this type of vertex and edge data.
ArangoDB ─ Features
ArangoDB 有许多值得注意的特性。我们将在下面重点介绍突出的特性 −
There are various notable features of ArangoDB. We will highlight the prominent features below −
-
Multi-model Paradigm
-
ACID Properties
-
HTTP API
ArangoDB 支持所有流行的数据库模型。以下是 ArangoDB 支持的几个模型 −
ArangoDB supports all popular database models. Following are a few models supported by ArangoDB −
-
Document model
-
Key/Value model
-
Graph model
一个查询语言就足以从数据库中检索数据
A single query language is enough to retrieve data out of the database
四个属性 Atomicity, Consistency, Isolation 和 Durability (ACID) 描述了数据库事务的保证。ArangoDB 支持符合 ACID 的事务。
The four properties Atomicity, Consistency, Isolation, and Durability (ACID) describe the guarantees of database transactions. ArangoDB supports ACID-compliant transactions.
ArangoDB 允许浏览器等客户端通过 HTTP API 与数据库交互,该 API 以资源为导向并可使用 JavaScript 进行扩展。
ArangoDB allows clients, such as browsers, to interact with the database with HTTP API, the API being resource-oriented and extendable with JavaScript.