HW 2.5: Error restarting mongod w/encryption

Hi. I created the keyfile using base64 and 32 length, chmod it to 600, and it’s there in my home directory. When I run the command to start mongod with the encryption options, I keep getting the error:

2020-11-13T15:54:27.563+0000 I CONTROL [initandlisten] options: { net: { port: 31251 }, processManagement: { fork: true }, replication: { replSet: “UNENCRYPTED” }, security: { enableEncryption: true, encryptionKeyFile: “./mongodb-keyfile” }, storage: { dbPath: “./M310-HW-2.5/r1” }, systemLog: { destination: “file”, path: “./M310-HW-2.5/r1/mongod.log” } }
2020-11-13T15:54:27.580+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),extensions=[local=(entry=mongo_addWiredTigerEncryptors)],encryption=(name=AES256-CBC,keyid=".system"),
2020-11-13T15:54:27.596+0000 E STORAGE [initandlisten] Unable to retrieve key .system, error: Error reading file ./mongodb-keyfile: No such file or directory
2020-11-13T15:54:27.596+0000 I - [initandlisten] Fatal Assertion 28561

I have used “–encryptionKeyFile mongodb-keyfile” and “–encryptionKeyFile ./mongodb-keyfile” - both give the same error. Here is a screen shot of my home folder:

Any ideas?

We need the screenshot that shows how you start mongod.

Hi - heres the screen shot:

BTW - I just tried destroying and rebuilding the “database” instance - I still get the same error when trying to restart the r1 secondary.

Ok - fixed it. Had to use the full path to the keyfile - “/home/vagrant/mongodb-keyfile”. Odd that this process needs full path when all the other scenarios using keyfile didn’t. Oh well… onwards!

1 Like