What is the default data directory for mongodb if we install that in amazon ec2

I tried to find this info everywhere and couldn't find it. I already change mongodb.conf so I forget where the original directory is.


Solution 1:

When you are searching a file in your filesystem while you are running Ubuntu a very easy way to find it is to do the following:

  1. Update the database with your files (may be a bit slow, depending on when it run the last time automatically from your system):

    sudo updatedb
    
  2. Search for the corresponding file (super quick):

    locate mongodb.conf
    

The config file name has recently change, now use locate mongod.conf (no more "b") (or just locate '*mongo*.conf', if you aren't sure).

Note: In the latest mongodb versions, the configuration file has been renamed to mongod.conf

Solution 2:

I'm not sure for amazon ec2 exactly but on my machine it is located at /var/lib/mongodb