Homework 1.2 output

Did preparation steps, validate-hw-1.2.sh output is

{ unauthorizedStatus: {“operationTime”:{"$timestamp":{“t”:1558332515,“i”:1}},“ok”:0,“errmsg”:“there are no users authenticated”,“code”:13,"$clusterTime":{“clusterTime”:{"$timestamp":{“t”:1558332515,“i”:1}},“signature”:{“hash”:{"$binary":“A3PDG1i/cwpkvjw4+dKJOBgOPLg=”,"$type":“00”},“keyId”:{"$numberLong":“6692982992035381249”}}}}, memberStatuses: [“PRIMARY”,“SECONDARY”,“SECONDARY”] }

So, it looks correct for me - “there are no users authenticated” when no users authenticated, replica set status when user is authenticated.

Copypasted full output to homewor “answer” - and it count as “Wrong”.

Tried restart, recreation, results are basically the same.


Well, the ‘unauthorized status’ isn’t correct here, If you’re set up correctly, you shouldn’t be able to check the status at all. I think you’ve probably created a user before you meant to, but I’ll have to run some tests myself to see exactly what the problem is. Let’s both look at this again and I’ll post back any results here. Thanks,

Retried it with mongod 3.6.
Recreated replica set, created keyfile, restarted with keyfile (loop with mongod --dbpath “$workingDir/r$i” --port ${ports[$i]} --replSet $replSetName --keyFile “$workingDir/mongodb-keyfile” --bind_ip_all -auth -fork --logpath “$workingDir/r$i/$logName.log”)
At this moment validate-hw-1.2.sh output is replica set status as “unathorised status” and “authentication error” and short status as “autorised status”.
User ‘admin’ created’.
Then we go back to
{ unauthorizedStatus: {“operationTime”:{"$timestamp":{“t”:1558413147,“i”:1}},“ok”:0,“errmsg”:“there are no users authenticated”,“code”:13,"$clusterTime":{“clusterTime”:{"$timestamp":{“t
“:1558413147,“i”:1}},“signature”:{“hash”:{”$binary”:“oV9h5+v/AUpOm6cYKkOyOKfPtFE=”,"$type":“00”},“keyId”:{"$numberLong":“6693330703997730819”}}}}, memberStatuses: [“PRIMARY”,“SECONDARY”

Is not it “We cannot read any status as unathenticated, got error message” and “We happily read status when we are logged in”?


Are you using the supplied ‘database’ VM? The code to start your replica set looks strange to me.

In particular, you have the options set as " -auth -fork" neither of which is valid (if you’ve posted this correctly??) – so I’m wondering just how you’ve set this up and what messages you’re getting. LMK.

Yes, supplied VM. And i just now fugured out why mongodb was initially not installed. Some initial startup errors. Will try it with more attention next time.

Reviewed start scripts - yes, options really are -auth and -fork instead of correct. Most funny - mongod ate them silently. I should use config file instead of long command line next time.


Yes, the answer that you show is consistent with your mongod processes not having authorization enabled. You can check that by simply going to the command line and entering ‘mongo’ to start the shell. If that works, then authorization is not enabled – if it were, then you’d get an error.