ywencn 发表于 2013-1-30 01:53:28

转//mongoDB安装

http://shiftcommathree.com/articles/how-to-install-mongodb-on-os-x

<span style="">How to install MongoDB on OS X

<div class="entry-content" style="margin-top: 0px; margin-right: 0px; margin-bottom: 3em; margin-left: 0px; padding: 0px;">I started playing with MongoDB this weekend. It’s a cool little database, and John Nunemaker’sMongoMapper gem is a treat. Mongo’s maintainers are nice enough to provide pre-compiled binaries for OS X, but you still have to do a little setup and configuration. (There’s actually a portfile on MacPorts, but it wasn’t up-to-date with the latest version when I found it.)
Here’s how I got the server installed and running as a daemon in OS X, for local development.
Download, unpack, and install the pre-compiled 64-bit binaries:
12345curl -O http://downloads.mongodb.org/osx/mongodb-osx-x86_64-1.4.0.tgztar xzf mongodb-osx-x86_64-1.4.0.tgzsudo mv mongodb-osx-x86_64-1.4.0 /usr/local/mongodbsudo mkdir /usr/local/mongodb_data /var/log/mongodbsudo chown -R root /usr/local/mongodb(If you’re on a 32-bit machine, substitute in i386 for each x86_64 above.)
Next, you’ll want to make a config file so you can change the server’s options without fiddling with command-line arguments.
Save as: /usr/local/mongodb/mongod.conf
12345# Store data alongside MongoDB instead of the default, /data/db/dbpath = /usr/local/mongodb_data# Only accept local connectionsbind_ip = 127.0.0.1Now, we’ll make a launchd job to register the server as an OS X daemon. launchd will start the server at startup, stop it before shutdown, make sure it stays up, and redirect its output to a nice log file.
Save as: /Library/LaunchDaemons/org.mongodb.mongod.plist
1234567891011121314151617181920212223242526<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Label</key><string>org.mongodb.mongod</string><key>ProgramArguments</key><array>    <string>/usr/local/mongodb/bin/mongod</string>    <string>run</string>    <string>--config</string>    <string>/usr/local/mongodb/mongod.conf</string></array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>WorkingDirectory</key><string>/usr/local/mongodb</string><key>StandardErrorPath</key><string>/var/log/mongodb/output.log</string><key>StandardOutPath</key><string>/var/log/mongodb/output.log</string></dict></plist>
页: [1]
查看完整版本: 转//mongoDB安装