{"action":"closed","issue":{"url":"https://api.github.com/repos/cvallance/mongo-k8s-sidecar/issues/88","repository_url":"https://api.github.com/repos/cvallance/mongo-k8s-sidecar","labels_url":"https://api.github.com/repos/cvallance/mongo-k8s-sidecar/issues/88/labels{/name}","comments_url":"https://api.github.com/repos/cvallance/mongo-k8s-sidecar/issues/88/comments","events_url":"https://api.github.com/repos/cvallance/mongo-k8s-sidecar/issues/88/events","html_url":"https://github.com/cvallance/mongo-k8s-sidecar/issues/88","id":354577476,"node_id":"MDU6SXNzdWUzNTQ1Nzc0NzY=","number":88,"title":"Calling rs.status immediately after rs.initiate throws auth error","user":{"login":"emanzaman","id":38486100,"node_id":"MDQ6VXNlcjM4NDg2MTAw","avatar_url":"https://avatars0.githubusercontent.com/u/38486100?v=4","gravatar_id":"","url":"https://api.github.com/users/emanzaman","html_url":"https://github.com/emanzaman","followers_url":"https://api.github.com/users/emanzaman/followers","following_url":"https://api.github.com/users/emanzaman/following{/other_user}","gists_url":"https://api.github.com/users/emanzaman/gists{/gist_id}","starred_url":"https://api.github.com/users/emanzaman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emanzaman/subscriptions","organizations_url":"https://api.github.com/users/emanzaman/orgs","repos_url":"https://api.github.com/users/emanzaman/repos","events_url":"https://api.github.com/users/emanzaman/events{/privacy}","received_events_url":"https://api.github.com/users/emanzaman/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-28T05:35:41Z","updated_at":"2018-08-28T10:15:01Z","closed_at":"2018-08-28T10:15:01Z","author_association":"NONE","body":"I have put all the steps to initiate a replica-set in a shell script. Basically, I am trying to convert a standalone instance A  to replica-set that includes one arbiter B and one secondary node C. These are the following steps in the script:\r\n\r\n1. Start the standalone instance without auth parameter.\r\n2. Create an admin user for mongodb admin database with the following role:\r\n    Successfully added user: {\r\n        \"user\" : \"mongodb_admin\",\r\n        \"roles\" : [\r\n                {\r\n                        \"role\" : \"root\",\r\n                        \"db\" : \"admin\"\r\n                }\r\n        ]\r\n}\r\n3. Stop the standalone instance A.\r\n4. Start all the three nodes(A, B,C) with replica-set option and key-file access control.\r\n5. Initiate replicaset on instance A by calling rs.initiate.\r\n6. Call rs.status to check if the health of all members is 1 (currently there is only A in replicaset)\r\n7. Add the arbiter node B and secondary node C to replicaset.\r\n8. Wait until all the nodes are healthy.\r\n\r\nEvrything is fine upto step 5. I am able to successfully initiate a replicaset. But step 6 throws the following error:\r\n`2018-08-27T11:43:47.080+0100 E QUERY    [thread1] Error: auth failed :\r\nDB.prototype._authOrThrow@src/mongo/shell/db.js:1608:20\r\n@(auth):6:1\r\n@(auth):1:2`\r\n\r\nWhen I put a sleep of 15 seconds in between steps 5 and 6, it works perfectly fine.\r\nBut I still want to make sure that I am doing things correctly. If yes then for how much longer should I sleep between steps 5 and 6 to ensure that the above mentioned error doesnt occur.\r\nAlso I am unable to understand why its giving an auth error even though I used the same user and password for initiating the replica-set?"}}
{"actor":{"display_login":"emanzaman"}}