[SERVER-6928] Better defaults for data directory Created: 04/Sep/12  Updated: 19/Mar/13  Resolved: 05/Sep/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Tyler Brock Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change
Participants:

 Description   

I'm proposing we should have a more sensible default for database location, either in a globally writable space or a user's home directory.

Making a folder and chowning it (as per our directions) is not any different than simply using a subdirectory of the home directory (except it requires zero steps instead of two).

Security: same.
Support: better (no steps vs. two in most cases) and everyone knows and has access to $HOME no matter what platform you are on.
Documentation: your data lives in $HOME/mongodb.

I think that this change is worth the effort. New users will be happy that they can now start using Mongo immediately without configuration.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 05/Sep/12 ]

There is no global default that works, and local is very dangerous.

Comment by Scott Hernandez (Inactive) [ 04/Sep/12 ]

This complicates things and makes it harder to support and document. There is no one right answer and we give users a tool to set this via the config file or command line opts.

Having this change dynamic based on the user will only complicate this in my experience. This is what packagers get to choose – they chose the correct behavior for their platform and users.

(tyler.brock@gmail.com: You might want to redefine the issue description so it is clear what they might vote on if this comes to something which is going to be considered.)

Comment by Tyler Brock [ 04/Sep/12 ]

The whole point of this is, if the data dir doesn't exist, we can create it. Just like everything else in mongo, a database, a collection, a document (via upsert).

Comment by Tyler Brock [ 04/Sep/12 ]

I'd also like to point out that we currently make other tweaks and settings changes based on platform (like no journaling on 32bit and small oplog on MacOSX). So this isn't far fetched or out of scope for a possibility.

Comment by Tyler Brock [ 04/Sep/12 ]

Well there are two ways to do it (which both make more sense than /data/db because virtually nobody has that already):

We can create it in a home directory or a globally writable space.

Lets say we took the home directory option:

Windows: C:\Documents and Settings\<username>\MongoDB
Mac OS X: /Users/<username>/MongoDB
Linux: /home/<username>/MongoDB

Lets say we took the globally writable dir option:

I'm not sure where this would go, maybe /var/lib or /usr/local? (I'd defer to unix/linux/windows/osx gurus on this)

The idea is that it should be in a place that makes sense as a User's or System's default data directory.

Comment by Scott Hernandez (Inactive) [ 04/Sep/12 ]

So, to sum this up you want what? Are you suggesting that starting mongod from different contexts it should use different paths to data? Are you trying to address multi-use systems where many users want to start mongod and data should be sep. for each?

What systems do you want this for? For packages like on linux the packaging system specifies the default location, which is standard and expected. The same is true for homebrew/freebsd. On windows we need a package installer.

Generated at Thu Feb 08 03:13:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.