![MongoDB数据目录传输和升级](https://linux22.com/image/563900/MongoDB%E6%95%B0%E6%8D%AE%E7%9B%AE%E5%BD%95%E4%BC%A0%E8%BE%93%E5%92%8C%E5%8D%87%E7%BA%A7.png)
我刚刚将我的数据目录(Mongo 1.6.5)转移到新服务器并在其上安装了 Mongo 2.0。我设置了数据目录路径并执行了sudo server mongod restart
。
它失败了,日志文件输出如下:
***** SERVER RESTARTED *****
Sun Oct 9 07:51:47 [initandlisten] MongoDB starting : pid=8224 port=27017 dbpath=/database/mongodb 64-bit host=domU-12-31-39-09-35-81
Sun Oct 9 07:51:47 [initandlisten] db version v2.0.0, pdfile version 4.5
Sun Oct 9 07:51:47 [initandlisten] git version: 695c67dff0ffc361b8568a13366f027caa406222
Sun Oct 9 07:51:47 [initandlisten] build info: Linux bs-linux64.10gen.cc 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_41
Sun Oct 9 07:51:47 [initandlisten] options: { auth: "true", config: "/etc/mongod.conf", dbpath: "/database/mongodb", fork: "true", logappend: "true", logpath: "/var/log/mongo/mongod.log", nojournal: "true" }
Sun Oct 9 07:51:47 [initandlisten] couldn't open /database/mongodb/local.ns errno:1 Operation not permitted
Sun Oct 9 07:51:47 [initandlisten] error couldn't open file /database/mongodb/local.ns terminating
Sun Oct 9 07:51:47 dbexit:
Sun Oct 9 07:51:47 [initandlisten] shutdown: going to close listening sockets...
Sun Oct 9 07:51:47 [initandlisten] shutdown: going to flush diaglog...
Sun Oct 9 07:51:47 [initandlisten] shutdown: going to close sockets...
Sun Oct 9 07:51:47 [initandlisten] shutdown: waiting for fs preallocator...
Sun Oct 9 07:51:47 [initandlisten] shutdown: closing all files...
Sun Oct 9 07:51:47 [initandlisten] closeAllFiles() finished
Sun Oct 9 07:51:47 [initandlisten] shutdown: removing fs lock...
Sun Oct 9 07:51:47 dbexit: really exiting now
我已经使用--upgrade运行过一次了。
答案1
我必须将文件的所有者更改为,mongod
然后它才有效。