Peter Rehm's Blog

apple,development,life & more

Installing MongoDB Binaries on Mac

Ohne Kommentare

Get latest binaries from here: http://www.mongodb.org/downloads
and unzip.

CODE:
sudo mv mongodb-osx-x86_64-2.2.1 /usr/local/mongodb
sudo mkdir /usr/local/mongodb_data /var/log/mongodb
sudo chown -R root /usr/local/mongodb
sudo vi /usr/local/mongodb/mongod.conf


Insert the following content

CODE:
# Store data alongside MongoDB instead of the default, /data/db/
dbpath = /usr/local/mongodb_data
 
# Only accept local connections
bind_ip = 127.0.0.1


Create a LaunchDaemon

CODE:
sudo vi /Library/LaunchDaemons/org.mongodb.mongod.plist


CODE:
<?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>


CODE:
sudo launchctl load /Library/LaunchDaemons/org.mongodb.mongod.plist


Try it with http://localhost:28017

CODE:
sudo sh -c 'echo "/usr/local/mongodb/bin" > /etc/paths.d/mongodb'

Geschrieben von Peter Rehm

05.11.2012 um 14:49:57

Tags für diesen Artikel: , ,