Mongodb version 3+ filestructure is different to previous versions

54 views
Skip to first unread message

LynnyK

unread,
Apr 18, 2016, 11:58:22 PM4/18/16
to mongodb-user
Hi,

I have Mongodb 2.6 version installed on server and the physical file for each database consists of
databasename.0
databasename.1
databasename.2 ...
and 1 .ns file
databasename.ns

I've now got another database server with 3.2 installed and noticed the filestructure is completely different.
The files i can see are a bunch of collection-nn-nnnnnnnnnnnnnnnn.wt and index-nn-nnnnnnnnnnnnnnnnnnnnnn.wt files.

In the earlier versions, if I wanted to copy the a database from one server to the other, I can just copy the files named with the same name, not so with version 3.

Is there a configuration or parameter to set so that the filestructure contained by database??

Does anyone understand the underlying file structure who can help me?


Thanks
Lyn

Kevin Adistambha

unread,
Apr 29, 2016, 1:37:58 AM4/29/16
to mongodb-user

Hi Lyn,

I have Mongodb 2.6 version installed on server and the physical file for each database consists of
databasename.0
databasename.1

databasename.2 …


and 1 .ns file
databasename.ns

These are MMAPv1 physical files. The MMAPv1 storage engine was the default (and only) storage engine for MongoDB version 2.6.x.

I’ve now got another database server with 3.2 installed and noticed the filestructure is completely different.
The files i can see are a bunch of collection-nn-nnnnnnnnnnnnnnnn.wt and index-nn-nnnnnnnnnnnnnnnnnnnnnn.wt files.

These are WiredTiger physical files, which is currently (as per MongoDB version 3.2.x) the default storage engine employed by MongoDB.

Is there a configuration or parameter to set so that the filestructure contained by database??

No. The file structure is determined by the selected database storage engine and cannot be changed. I would also strongly discourage copying individual files between dbpath (especially on a running mongod instance) as this will likely introduce data corruption.

If you need to copy one database to another server, you might want to take a look at the db.copyDatabase() command instead.

Also, there are many advantages of using WiredTiger compared to MMAPv1, such as:

  • Document level concurrency
  • Better multithreaded performance
  • Compression
  • MultiVersion Concurrency Control to ensure data consistency

Unless you have a very specific need for MMAPv1 features, I would recommend you to use the WiredTiger storage engine instead due to WiredTiger’s generally better performance, concurrency abilities, and compression capabilities. Also, MMAPv1 files may be larger compared to the actual data size, due to storage padding and fragmentation.

Best regards,
Kevin

Lyn Ko

unread,
Apr 30, 2016, 1:04:14 AM4/30/16
to mongod...@googlegroups.com
Thanks Kevin for taking time to reply

I also found the Config setting storage.directoryPerDB...was able to group all the files per db using this which was good

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/cRz6jrl-UFU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/bf793ec2-2965-4dc3-9273-ea5e217943d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages