MongoDB 4 Quick Start Guide
上QQ阅读APP看书,第一时间看更新

Configure and run MongoDB on Ubuntu/Debian

If you followed the procedure outlined in the previous section, a configuration file /etc/mongod.conf will have been auto-generated by the installation script. By default, data files will be placed in /var/lib/mongodb and log files in /var/log/mongodb/mongod.log:

You are now able to perform these operations:

    
Operation           Command
Start | stop | restart the server           sudo service mongod start|stop|restart
Get the server status           sudo service mongod status
Access MongoDB via the shell (covered later)           mongo --host 127.0.0.1:27017
Here you can see the server started, along with its status:
MongoDB installation scripts now automatically bind MongoDB to localhost (IP address 127.0.0.1) for security reasons.