0

I am using docker to deploy mongodb ops manager, then i get the following error message

The gen.key file at /etc/mongodb-mms/gen.key does not match the gen.key already used for this Ops Manager installation. The key file for this Ops Manager server must be copied from another server. I only deployed ops in a node, where should I copy this file from it?

2 Answers2

3

First, make sure that your key is at /etc/mongodb-mms/gen.key and the permissions are correct so that the owner of the mongodb-mms service can read the key.

If you have tried to start the mongodb-mms service already, you may need to drop the configuration databases and try again.

To do this, connect to your replica set (or single mongod in your case) with the shell, show dbs and and drop every database that isn't admin or local. For example:

use mmsdbconfig

db.dropDatabase()

Try to start ops manager again:

sudo service mongodb-mms start

  • This is working! As ops manager creates multiple database, they can be dropped using script: var dbs = db.getMongo().getDBNames() for(var i in dbs){ db = db.getMongo().getDB( dbs[i] ); if (db.getName() !== 'admin' && db.getName() !== 'local') { print( "dropping db " + db.getName() ); db.dropDatabase(); } } Ref: https://stackoverflow.com/questions/51521199/how-to-drop-all-databases-in-mongodb – SaP Feb 04 '22 at 12:28
0

I had recently same problem . In my case ops-manager and mongodb are running on Docker container. "The gen.key file at /etc/mongodb-mms/gen.key does not match the gen.key already used " problem is , if you would like to run ops-manager on your server as a service , ops-manager uses gen.key file once it was generated at first time. But if ops-manager is running on docker container , when every running the container, it creates a new gen.key file inside container, that’s why gen.key file doesn’t match previous one. You can test it so. Actually i solved this problem , i extract the gen.key file from docker container after i run container. Then i restarted container then i looked the logs and i saw this error again "The gen.key file at /etc/mongodb-mms/gen.key does not match the gen.key already used ".. Then i copied gen.key file which i extracted , into docker container , then it started to work.