Homework 1.2 : Enabling Authentication on a Running Replica Set

Hi,

I have tried to work on this Homework.

  • If i use the /home/vagrant/shared as the base folder and work I am unable to set permission (chmod 400 on keyfile was not working so my mongod was failing). Was getting the following error " ACCESS [main] permissions on /vagrant/shared/mongodb-keyfile are too open when i start mongod"

  • While creating db path in shared folder was getting the following error:
    /home/vagrant/shared/ directory-sync: fdatasync: Invalid argument (mongodb does not support with datasync)

Had googled and as per the suggestion given moved the keyfile and other folders both dbpath and log to another folder /var/mongodb… meaning put into non-shared folder**** things worked fine. spent almost 2 days on this :wink:

Anyhow covered up all the above issues have completed the exercise as given:

Have created the replica set. rs.status() output below.

Not sure what to paste in the given box. I pasted the output was saying incorrect. Pls suggest what needs to be done.

vagrant@database:/var/mongodb/m310-hw-1.2$ ./validate-hw-1.2.sh

{ unauthorizedStatus: {“ok”:0,“errmsg”:“not authorized on admin to execute command
{ replSetGetStatus: 1.0}”,“code”:13}, memberStatuses: [“PRIMARY”,“SECONDARY”,“SECONDARY”] }

Your rs.status() and validate looks fine
Have you created the user?

Why shared dir?
They asked you to use a specific dirpath

DBPath ~/M310-HW-1.2/r0
~ means your home dir /home/vagrant
Same for all other dirs logpath,keyfiles
Please stick to the instructions given in the lab else validation fails

Hi Ramachandra,

I have created the user.

Has I have mentioned in my message, when i use the /home/vagrant/shared folder. Try to change the permission using chmod 400 … it does not work exactly the way we want… so had to create keyfile in /var/mongodb/pki (new folder)… works fine… (I got this hint to switch to a non-shared folder in google).
After that had a issue creating dbPath in shared folders…
/home/vagrant/shared/ directory-sync: fdatasync: Invalid argument ( his happened because data directory is in a shared folder which is not supported as [MongoDB ])

*So changed my dbPath to /var/mongodb/m103…

I think could be because I work on windows 7 where I have installed vagrant… I could not stick to the folder instructions given in the lab doc because of the above issues… otherwise the steps have gone thru fine…

In which o/s did you have your vagrant installed? windows if so which version?

Thanks.

Your validation script snapshot shows you are on vagrant@database
So what is the issue in creating the dirs mentioned in the lab?
I understood you faced issue while using shared dir
Under /home/vagrant you should create M310-HW-1.2 under this sub dirs r0,r1,r2 etc for each node

I don’t think anything to do with Windows7.It is your host machine and your guest machine is vagrant
Many other students did this course on Win 7

Please check your steps again as per lab requirements

I have sent the same output to Mongodb team and they have told the output has some special characters and that is why the result was incorrect… But unfortunately copy pasted again from vagrant into result box… Just thought will update you…

But then what I learnt from the following errors:
*i f i use the /home/vagrant/shared as the base folder and work I am unable to set permission (chmod 400 on keyfile was not working so my mongod was failing). Was getting the following error " ACCESS [main] permissions on /vagrant/shared/mongodb-keyfile are too open when i start mongod"

Solution : I modified the Vagrantfile to chmod 600 and made it work

  • While creating db path in shared folder was getting the following error:
    /home/vagrant/shared/ directory-sync: fdatasync: Invalid argument (mongodb does not support with datasync)

Solution: Either change the directory of dbpath and logpath to anything other than shared folder or change the storage engine from WiredTiger (default) to mmpav1. For overcome the (fdatasync: Invalid arguement) testing purpose this should be fine.