Introducing Spring Framework

Introducing Spring Framework Introducing Spring Framework

25.02.2015 Views

Appendix A ■ Installing Tools Figure A-27. Path Environment Variable with the MONGODB_HOME/bin The MongoDB server also needs a storage path where it will allocate all the data for your collections (these collections will hold all the documents and types that you will be using in several chapters). So every time you start the server you need to add this path with the --dbpath parameter. Start MongoDB server To start the MongoDB server, execute the following command (also see Figure A-28). It is important that the DATA path exists: C:\> mongod --dbpath C:\Data\mongodb Figure A-28. Running MongoDB 310

Stop MongoDB Server Appendix A ■ Installing Tools To stop the MongoDB server, just press Ctrl+C from the window where it is running and it will close all connections and shut down the server. ■ ■Note If you need to run MongoDB as a service, you can follow the steps from MongoDB’s web site: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/. Installing MongoDB on a Mac OS X You need to install the Homebrew tool first (remember, Homebrew makes it easy to install any tool or library). To install MongoDB, just execute the following commands: $ brew update $ brew install mongodb After installing MongoDB, make sure everything is installed correctly by executing $ mongo -version MongoDB shell version: 2.6.1 Start MongoDB server To start the MongoDB server on your Mac, just execute the following command: $ brew services start mongodb ==> Successfully started `mongodb` (label: homebrew.mxcl.mongodb) Stop MongoDB server To stop the MongoDB server, just execute the following command: $ brew services stop mongodb Stopping `mongodb`… (might take a while) ==> Successfully stopped `mongodb` (label: homebrew.mxcl.mongodb) Start MongoDB at Login If you want to have MongoDB started every time you login into your Mac, the following command will do the trick: $ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents ■Note ■ How you install MongoDB on a Linux computer will depend on your version of Linux, either RPM (for RedHat-based distributions) or .deb (for Debian-based distributions). Usually you can find the installation package at the MongoDB site (www.mongodb.org/downloads). 311

Stop MongoDB Server<br />

Appendix A ■ Installing Tools<br />

To stop the MongoDB server, just press Ctrl+C from the window where it is running and it will close all connections<br />

and shut down the server.<br />

■ ■Note If you need to run MongoDB as a service, you can follow the steps from MongoDB’s web site:<br />

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/.<br />

Installing MongoDB on a Mac OS X<br />

You need to install the Homebrew tool first (remember, Homebrew makes it easy to install any tool or library). To<br />

install MongoDB, just execute the following commands:<br />

$ brew update<br />

$ brew install mongodb<br />

After installing MongoDB, make sure everything is installed correctly by executing<br />

$ mongo -version<br />

MongoDB shell version: 2.6.1<br />

Start MongoDB server<br />

To start the MongoDB server on your Mac, just execute the following command:<br />

$ brew services start mongodb<br />

==> Successfully started `mongodb` (label: homebrew.mxcl.mongodb)<br />

Stop MongoDB server<br />

To stop the MongoDB server, just execute the following command:<br />

$ brew services stop mongodb<br />

Stopping `mongodb`… (might take a while)<br />

==> Successfully stopped `mongodb` (label: homebrew.mxcl.mongodb)<br />

Start MongoDB at Login<br />

If you want to have MongoDB started every time you login into your Mac, the following command will do the trick:<br />

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents<br />

■Note ■ How you install MongoDB on a Linux computer will depend on your version of Linux, either RPM<br />

(for RedHat-based distributions) or .deb (for Debian-based distributions). Usually you can find the installation<br />

package at the MongoDB site (www.mongodb.org/downloads).<br />

311

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!