Skip to content

Instantly share code, notes, and snippets.

@zhanghui9700
Created September 27, 2016 15:37
Show Gist options
  • Save zhanghui9700/51a905ba8f5d425a38129171b99433d1 to your computer and use it in GitHub Desktop.
Save zhanghui9700/51a905ba8f5d425a38129171b99433d1 to your computer and use it in GitHub Desktop.

mongodb datafiles

The .0, .1 files are datafiles. Each datafile is preallocated to a particular size. (This is done to prevent file system fragmentation, among other reasons.) The first filename for a database is .0, then .1, etc. .0 will be 64MB, .1 128MB, et cetera, up to 2GB. Once the files reach 2GB in size, each successive file is also 2GB. Information regarding datafiles can be found here:

http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

The ".ns" files are namespace files. Each collection and index would count as a namespace. Each namespace is 628 bytes, the .ns file is 16MB by default.

Thus if every collection had one index, we can create up to 12,000 collections. The --nssize parameter allows you to increase this limit.

Maximum .ns file size is 2GB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment