Quick reference card

      Cloud Servers Virtual Machines Native Installers
    Configuration file(s) /opt/bitnami/mongodb/mongodb.conf /opt/bitnami/mongodb/mongodb.conf install_dir/mongodb/mongodb.conf
    Log file(s) /opt/bitnami/mongodb/log/mongodb.log /opt/bitnami/mongodb/log/mongodb.log install_dir/mongodb/log/mongodb.log
    Data directory /opt/bitnami/mongodb/data/db /opt/bitnami/mongodb/data/db install_dir/mongodb/data/db
    UNIX socket /opt/bitnami/mongodb/tmp/mongodb-*.sock /opt/bitnami/mongodb/tmp/mongodb-*.sock install_dir/mongodb/tmp/mongodb-*.sock (Linux and Mac OS X)
    Default port 27017 27017 27017
    System user account mongodb mongodb mongodb
    Service control sudo /opt/bitnami/ start|stop|restart mongodb sudo /opt/bitnami/ start|stop|restart mongodb install_dir/ start|stop|restart mongodb

    How to start/stop the MongoDB server?

    Graphical tool

    The native installers include a graphical tool to manage the servers easily. You can find the "manager-windows.exe", "manager-osx" or "manager-linux" tool in your installation directory. Using this tool, you can Start, Stop or Restart the servers and check the log files. You can click on the icon to start it.














    On Windows: You can also start the Manager tool from shortcuts: Start -> Program Files -> Bitnami Stack -> Manager tool

    Command line tool

    If you prefer, you can use the "" utility from the command line. This script is in the installation directory.


    On Virtual Machines and Cloud images:

    $ sudo /opt/bitnami/ start

    A native installer on Linux:

    $ cd ~/application-version
    $ ./ start



    On OS X: You can start the Manager tool from the installation directory or you can use the "" utility from a Terminal.

    host:~ user$ cd /Applications/application-version
    host:~ user$ ./ start

    What is the default configuration?

    The MongoDB admin user for all databases is created during the BitNami Stack installation process. The default configuration consists of: 

    • A privileged account with a username of 'root'. The initial password for this account is the same you specified in the setup wizard.
      • If you are using the Virtual Appliance or the AMI, the password is "bitnami" by default.
      • If you are using BitNami Cloud Hosting, the password is the same that you set from the admin panel.

    It is strongly recommended that you do not have empty passwords for any user accounts when using the server for any production work.

    For security reasons, the MongoDB database does not allow external connections by default. You only can connect from the local machine.

    MongoDB socket

    On Unix, the MongoDB clients can connect to the server using a Unix socket file. In a BitNami Stack, the default socket file is created in /installdir/mongodb/tmp/mongodb.sock. Usually when you use the MongoDB client tool included in the stack, you will not need to specify the socket for the connection.

    How to connect to the MongoDB database?

    You can connect to the MongoDB database from the same computer where it is installed:

    1. Open the BitNami console
    2. Run the mongo client authenticating as the 'root' user against the 'admin' database:
    $ mongo admin --username root --password YOURPASSWORD

    You can also run the MongoDB client directly "/installdir/mongodb/bin/mongo". You can also manage the mongDB database from a browser. You can find more info at RockMongo.

    How to connect to the MongoDB database from a different machine?

    You can enable external connections for the MongoDB database by editing the following option in the "/opt/bitnami/mongodb/mongodb.conf":

    bind_ip =

    You can change this value with a valid IP from the same computer where it is installed. You can specify multiple IPs separating each IP with a comma (","). For example, if you want MongoDB to be remotely accessible on all network interfaces, you can change the IP to

    Then, restart the MongoDB server and you can access the MongoDB database from any machine.

    sudo /opt/bitnami/ restart mongodb

    If you are using a Virtual Appliance, it is also necessary to open the mongoDB port in the firewall

    How to create a database for a custom application?

    If you want to install an application manually, it may require the database settings during the installation. These are the basic steps to create a database for your application. You should run the following commands from the console, which you can access in the Windows shortcuts or from the Terminal on OS X and Linux.

    $ mongo admin --username root --password YOURPASSWORD
    MongoDB shell version: 2.4.8
    connecting to:
    > db = db.getSiblingDB('database_name')
    > db.createUser( { user: "database_user", pwd: "database_password", roles: [ "readWrite", "dbAdmin" ]} )
     "user" : "database_user",
     "pwd" : "...",
     "roles" : [
     "_id" : ObjectId("...")
    > exit

    Some applications may require specific privileges in the database. Consult the official installation steps in the application documentation.

    How to change the MongoDB root password?

    By default, the database cannot be accessed from outside of the Virtual Machine or AMI but it is still recommended that you change the root password. You can modify the MongoDB password using the following command at the shell prompt:

    $ mongo admin --username root --password YOURPASSWORD
    MongoDB shell version: 2.4.8
    connecting to:
    > db = db.getSiblingDB('admin')
    > db.changeUserPassword("root", "newpassword")
    > exit
    • The default password for the MongoDB root user in Virtual Appliances and AMIs is "bitnami".
    • The default password for the MongoDB root user in BitNami Cloud Hosting is the same as what you set in the administration panel.

    How to reset the MongoDB root password?

    You can reset the admin user by following the steps below:

    Note: For native installers, please, replace /opt/bitnami with your current installation directory.

    1. Edit the /opt/bitnami/mongodb/mongodb.conf and replace the following line:
    setParameter = enableLocalhostAuthBypass=0


    #setParameter = enableLocalhostAuthBypass=0
    1. Remove admin credentials from your current MongoDB:
    $ mv /opt/bitnami/mongodb/data/db/admin.* /tmp
    1.  Restart the MongoDB server:
    $ /opt/bitnami/ restart mongodb

    Now you can create a new admin user with a new password. Run the following commands to do so:

    $ mongo
    > db = db.getSiblingDB('admin')
    > db.createUser( { user: "root", pwd: "new_password", roles: [ "readWriteAnyDatabase", "userAdminAnyDatabase", "dbAdminAnyDatabase", "clusterAdmin" ]} )

    Do not forget to revert the modification of /opt/bitnami/mongodb/mongodb.conf by replacing:

    #setParameter = enableLocalhostAuthBypass=0


    setParameter = enableLocalhostAuthBypass=0

    And restart the MongoDB server again.

    How to create a database backup?

    If you are interested in a backing up the data contained in your database, you can create a dump file using the “mongodump” tool.

    $ mongodump --authenticationDatabase admin --username root --password YOURPASSWORD -d database_name

    This operation could take some time depending on the amount of data that you have stored in the database.

    Alternatively, if you want to create a back of your full environment, please  see Native_Installers_Quick_Start_Guide#How_can_I_create_a_full_backup_of_a_Stack.3f.

    How to restore a database backup?

    If you need to restore data backed up using the previous command, you can restore a dump file using the “mongorestore” tool.

    $ mongorestore --authenticationDatabase admin --username root --password YOURPASSWORD path_to_database_dump_folder

    Note that the steps previously described will only back up the data contained inside your database. There may be other files what you you should take into account when performing a full backup, such as files that may have been uploaded to the application (if you support that type of functionality). These files are stored in the application folder itself so you can copy this folder to have a backup of your uploaded files.

    How to change the data directory?

    The data directory for MongoDB is in /installdir/mongodb/data/db folder by default. You can modify the location of this folder modifying the following files:



    Then move the "db" folder to the new location and restart the MongoDB server.

    How to debug errors?

    The main MongoDB log file is created at /installdir/mongodb/log/mongodb.log file.

    Tag page (Edit tags)
    • No tags
    Pages that link here
    Page statistics
    41137 view(s), 25 edit(s) and 10550 character(s)


    You must login to post a comment.

    Attach file