My understanding is that Percona Server for MongoDB (latest version) is already compiled with the rocksdb engine. Yet, when I set the flag to use it, the service fails to start. It exits with code 100 (uncaught exception), and there is no journal output. Does anyone have any idea what could be causing this? Thanks in advance.
问问题
907 次
2 回答
3
您可能会在日志中看到类似的内容:
2016-03-10T21:17:23.433-0600 I CONTROL ***** SERVER RESTARTED *****
2016-03-10T21:17:23.435-0600 I ACCESS Initialized External Auth Session
2016-03-10T21:17:23.437-0600 I CONTROL [initandlisten] MongoDB starting : pid=1323 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu14
2016-03-10T21:17:23.437-0600 I CONTROL [initandlisten] db version v3.0.8-1.3
2016-03-10T21:17:23.437-0600 I CONTROL [initandlisten] git version: 354592f7850d8d113690f610049baec94812da2b
2016-03-10T21:17:23.437-0600 I CONTROL [initandlisten] build info: Linux vps-trusty-x64-01 2.6.32-042stab112.15 #1 SMP Tue Oct 20 17:22:56 MSK 2015 x86_64 BOOST_LIB_VERSION=1_49
2016-03-10T21:17:23.437-0600 I CONTROL [initandlisten] allocator: tcmalloc
2016-03-10T21:17:23.437-0600 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { pidFilePath: "/var/run/mongod.pid" }, storage: { dbPath: "/var/lib/mongodb", engine: "rocksdb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2016-03-10T21:17:23.503-0600 I STORAGE [initandlisten] exception in initAndListen: 28574 Cannot start server. Detected data files in /var/lib/mongodb created by storage engine 'mmapv1'. The configured storage engine is 'rocksdb'., terminating
2016-03-10T21:17:23.503-0600 I CONTROL [initandlisten] dbexit: rc: 100
如果是这样,问题是您已经启动了服务器,并在 dbpath 中使用不同的存储引擎数据集指定了 Rocksdb 引擎。为了解决此问题,您需要从 dbpath 中删除文件以使用新引擎。
如果您在 MongoDB 中有想要保留的现有数据,那么您将首先要使用mongodump工具备份可以在切换存储引擎并重新启动服务器后使用mongorestore恢复的信息。
要在/etc/mongod.conf中更改存储引擎后从干净的 dbpath 开始,请发出以下命令(以 root 身份):
注意:这将永久删除存储在 MongoDB 数据库中的所有数据:
# service mongod stop
# rm -rf /var/lib/mongodb/*
# service mongod start
几秒钟后,您应该会在日志文件的底部看到以下消息。
# tail /var/log/mongodb/mongod.log
2016-03-10T21:25:30.398-0600 I CONTROL ***** SERVER RESTARTED *****
2016-03-10T21:25:30.400-0600 I ACCESS Initialized External Auth Session
2016-03-10T21:25:30.402-0600 I CONTROL [initandlisten] MongoDB starting : pid=1530 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu14
2016-03-10T21:25:30.402-0600 I CONTROL [initandlisten] db version v3.0.8-1.3
2016-03-10T21:25:30.402-0600 I CONTROL [initandlisten] git version: 354592f7850d8d113690f610049baec94812da2b
2016-03-10T21:25:30.402-0600 I CONTROL [initandlisten] build info: Linux vps-trusty-x64-01 2.6.32-042stab112.15 #1 SMP Tue Oct 20 17:22:56 MSK 2015 x86_64 BOOST_LIB_VERSION=1_49
2016-03-10T21:25:30.402-0600 I CONTROL [initandlisten] allocator: tcmalloc
2016-03-10T21:25:30.402-0600 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { pidFilePath: "/var/run/mongod.pid" }, storage: { dbPath: "/var/lib/mongodb", engine: "rocksdb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2016-03-10T21:25:30.808-0600 I NETWORK [initandlisten] waiting for connections on port 27017
于 2016-03-11T03:30:23.287 回答
1
编辑 /etc/mongod.conf 时,确保不要放太多缩进(空格)。
storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine: mmapv1
# engine: PerconaFT
engine: rocksdb #---->only two spaces
# engine: wiredTiger
我也有同样的问题,我花了好几天才弄明白。
于 2016-04-26T17:18:51.153 回答