MongoDB试用

os: Ubuntu8.04

cpu: amd


安装步骤:

http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages


Start Server: sudo /etc/init.d/mongodb start

Stop Server: sudo /etc/init.d/mongodb stop

MongoDB配置文件: /etc/mongodb.conf


启动后,查看log: tail -f /var/log/mongodb/mongodb.log

Sun Oct 30 17:19:20 [initandlisten] options: { command: [ "run" ], config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }

log文件中显示的dbpath: /var/lib/mongodb


1. 我们修改mongodb.conf, 修改为:

  #dbpath=/var/lib/mongodb
  dbpath=/data/db

2 重新启动mongodb的server, 执行sudo /etc/init.d/mongodb start.

3 查看log, 发现log日志仍然显示:

[initandlisten] options: { command: [ "run" ], config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }


也就是说mongodb.conf修改后没有生效。我百思不得其解,果断google之。

看了半天http://groups.google.com/group/mongodb-user/browse_thread/thread/a6e621b46dfe0858/e6371d263d4977d9?lnk=gst&q=conf#e6371d263d4977d9


查看了下/etc/init.d/mongodb,终于弄明白了,这的确是个bug啊。 

 88 DAEMONUSER=${DAEMONUSER:-mongodb}
 89 DAEMON_OPTS=${DAEMON_OPTS:-"--dbpath $DATA --logpath $LOGFILE run"}
 90 DAEMON_OPTS="$DAEMON_OPTS --config $CONF"

改为:

 88 DAEMONUSER=${DAEMONUSER:-mongodb}
 89 #DAEMON_OPTS=${DAEMON_OPTS:-"--dbpath $DATA --logpath $LOGFILE run"}
 90 DAEMON_OPTS="$DAEMON_OPTS --config $CONF"


重新执行sudo /etc/init.d/mongodb start.log

[initandlisten] options: { command: [ "run" ], config: "/etc/mongodb.conf", dbpath: "/data/db", logappend: "true", logpath: "/var/log/mongodb/mongodb.log" }




你可能感兴趣的:(mongodb,mongodb,command,server,ubuntu,google,os)