3

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.

Lee3
  • 2,882
  • 1
  • 11
  • 19

2 Answers2

3

You might be seeing something like this in the logs:

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

If so, the problem is that you have started the server specifying the rocksdb engine with a different storage engine dataset still in the dbpath. In order to resolve this issue you will need to remove the files from your dbpath to use the new engine.

If you have existing data in MongoDB that you want to keep, then you will first want to use the mongodump tool to backup the information which can be restored with mongorestore after you switch storage engines and restart the server.

To start with a clean dbpath after changing your storage engine in /etc/mongod.conf, issue the following commands (as root):

NOTE: This will permanently remove any data stored in your MongoDB database:

# service mongod stop
# rm -rf /var/lib/mongodb/*
# service mongod start

After a few seconds you should see the following message at the bottom of your log file.

# 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
David H. Bennett
  • 1,822
  • 13
  • 16
1

When editing /etc/mongod.conf, make sure you do not put too much indention (spaces).

storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
#  engine: mmapv1
#  engine: PerconaFT
  engine: rocksdb  #---->only two spaces
#  engine: wiredTiger

I has the same issue and it took me days to figured this out.