Mac OS X下怎样让MongoDB开机即启动?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac OS X下怎样让MongoDB开机即启动?相关的知识,希望对你有一定的参考价值。
可以把MongoDB放到开机启动项里面就可以了。进入OS X系统之后,点击苹果图标,选择系统偏好设置,选择用户与群组,选择当前登录用户,然后选择“登录选项”,点按“+”添加MongoDB,然后就可以开机启动了。 参考技术A 终端运行 mongod --config /opt/local/etc/mongodb/mongodb.conf 可正常启动launchctl load /Library/LaunchDaemons/org.mongodb.mongod.plist 。
以下是plist文件内容:
<?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>/opt/local/bin/mongod</string>
<string>run</string>
<string>--config</string>
<string>/opt/local/etc/mongodb/mongodb.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> 参考技术B 自问自答。WTF,路径搞错了,搞错了,错了。。。
如何在mac os x下启动mysql
If MySQL Startup Item is installed : shell> sudo /Library/StartupItems/MySQL/MySQL start (Enter your password, if necessary) (Press Control-D or enter "exit" to exit the shell) If MySQL Startup Item is NOT installed : shell> cd /usr/local/mysql shell> sudo ./bin/mysqld_safe (Enter your password) (Press CTRL+Z) shell> bg (Press CTRL+D to exit the shell)
以上是关于Mac OS X下怎样让MongoDB开机即启动?的主要内容,如果未能解决你的问题,请参考以下文章