Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The system of mongodb

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

MongoDB logical structure

It consists of three parts: document, collection and database.

MongoDB document: The basic unit of data in mongodb, equivalent to a row of records in a relational database. Each document has a special key "_id", which is unique in the collection to which the document belongs.

Collection: A concept equivalent to tables in relational databases.

The hierarchical structure of document, collection and database is as follows:

Document corresponds to row in relational data

A collection corresponds to a table in relational data.

database corresponds to relational database

The MongoDB data directory stores all MongoDB data files

[mongo@xxxx-xx-xx data]$ ll Total Usage 1212436drwxr-xr-x. 2 mongo dbmon 69 Oct 28 17:15 diagnostic.datadrwxr-xr-x. 2 mongo dbmon 27 Oct 28 15:25 journal-rw-----. 1 mongo dbmon 67108864 Oct 28 15:25 local.0-rw-----. 1 mongo dbmon 1073741824 Oct 28 17:15 local.1-rw-----. 1 mongo dbmon 16777216 Oct 28 17:14 local.ns-rw-r--r--. 1 mongo dbmon 6 Oct 28 15:17 mongod.lock-rw-r--r--. 1 mongo dbmon 69 Oct 28 15:17 storage.bson-rw-----. 1 mongo dbmon 67108864 Oct 28 17:00 sykdb.0-rw-----. 1 mongo dbmon 16777216 October 28 17:00 sykdb.nsdrwxr-xr-x. 2 mongo dbmon 6 Oct 28 15:54 _tmp

Inside MongoDB, each database contains a.ns file and a number of data files, such as local.ns,local.0,local.1, the number of files increasing as the data volume increases.

Each table has a namespace, and each index has a namespace. Metadata for these namespaces is stored in *.ns files.

MongoDB has an internal mechanism for pre-allocating space, pre-allocated files are filled with zeros, so mongodb always keeps extra space and spare data files. Each time a new data file is generated, it is twice the size of the previous data file. For example, local.0 is 67108864, local.1 is 1073741824

Reference: mongodb family-architecture

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report