Install First:
Environment Mac OS X
I am the direct use of brew to install, feel this package management tools, very worry.
Install Homebrew:ruby -E "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
Uninstall Homebrew:ruby -E "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
1, update brew itself brew Update2, use Brew installation software Brew install Soft_name// soft_name for you to install the software logo, If you are using brew to install Gitbrew installation git3, use brew uninstall software Brew Uninstall Soft_name// Soft_name for the logo you want to uninstall the software, If you use Brew to uninstall Gitbrew uninstall git4, display the list of software using Brew installation Brew List5, update software brew upgrade// Update all BREW-installed software using brew upgrade git // update a brew-installed software 6, see which software needs to be updated brew outdated7, Find software // When you can't remember the name of the software, you can use search, just write a few letters, he will help you Lenovo, and all possible results output to you brew search8--cache
After the installation is successful, we start to install MongoDB:
1: Installing MongoDB
Brew Install MongoDB
2: After the installation is complete, you will find unable to start, if the input Mongod will report the following error.
2018-01-21t16:48:26.050+0800 I CONTROL [Initandlisten] MongoDB starting:pid=3663 port=27017 dbpath=/data/db 64-bit Host =macbook-pro.local2018-01-21t16:48:26.050+0800 I CONTROL [initandlisten] DB version v3.6.22018-01-21t16:48:26.050+0800I CONTROL [initandlisten] git version:489d177dbd0f0420a8ca04d39fd78d0a2c5394202018-01-21t16:48:26.050+0800 I CONTROL [Initandlisten] OpenSSL version:openssl 1.0.2n 7 Dec 20172018-01-21t16:48:26.050 +0800I CONTROL [Initandlisten] Allocator:system2018-01-21t16:48:26.050+0800I CONTROL [Initandlisten] Modules:none2018-01-21t16:48:26.050+0800I CONTROL [Initandlisten] Build environment:2018-01-21t16:48:26.050+0800I CONTROL [Initandlisten] distarch:x86_642018-01-21t16:48:26.050+0800I CONTROL [Initandlisten] target_arch:x86_642018-01-21t16:48:26.050+0800I CONTROL [Initandlisten] options: {}2018-01-21t16:48:26.053+0800 I STORAGE [Initandlisten] exceptioninchInitAndListen:NonExistentPath:Data directory/data/db notfound., terminating2018-01-21t16:48:26.053+0800I CONTROL [Initandlisten] now exiting2018-01-21t16:48:26.053+0800 I CONTROL [Initandlisten] shutting down with code:100
It's normal! Don't panic, I'll take you.
3: Before starting MONGO, we need to create a directory for MONGO default data to be written to the directory.
Note: The default directory is data/under the root directory-p/data/db
4: Then, to do one thing, you can use MongoDB.
Command line under the folder you just created:chown ' id-u '/data/db
Note: If you do not use the command line to modify the permissions, you can go to the/data folder right click on the display introduction , and then select the bottom of the share and permissions to change the ownership limit to read and write. (is to change all three permissions to read and write!!!) )
5: Modify Directory
# The/data/db directory is the default directory for MONGO, and if you want to use a different directory, you can make the--dbpath parameter MONGO--dbpath dir_name # dir_name The name of your directory
Next: You can start your MongoDB!
First Execute:
Mongod
Then: Re-open a window to execute:
MONGO # Note: Be sure to perform the MONGO after successful Mongod first # appears > indicates successful link
If one day you find your database suddenly can not start, may be you for normal shutdown caused, you can delete the/data/db folder in the Mongod.lock file , and then restart, if not, you can check the process, and then kill:
Input instruction: grep MONGO
It then kills the process based on the process ID and finally restarts MongoDB.
About MongoDB installation, that's it!
Next entry:spider_man_3のmongodb_ use
Spider_man_3のmongodb_ Installation