Error appears when adding others machine to my replicaSet

Homework 1.5: Enabling Mixed Authentication Mechanisms

After creating successfully mongod replicat ,error appears when adding other machine to replica set , primary goes on SECONDARY and other mongod stays in STARTUP MODE

as you can you can see with ./validate-hw-1.5.sh
this is ouput that i got

{ unauthorizedStatus: {“ok”:0,“errmsg”:“not authorized on admin to execute command { replSetGetStatus: 1.0 }”,“code”:13}, memberStatuses: [“SECONDARY”,“STARTUP”,“STARTUP”], users: 2019-09-20T15:43:37.817+0000 E QUERY [thread1] Error: error: { “ok” : 0, “errmsg” : “not master and slaveOk=false”, “code” : 13435 } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DBCommandCursor@src/mongo/shell/query.js:689:1 DBQuery.prototype._exec@src/mongo/shell/query.js:118:28 DBQuery.prototype.hasNext@src/mongo/shell/query.js:276:5 DBQuery.prototype.toArray@src/mongo/shell/query.js:325:12 @(shell eval):7:22 }
vagrant@database:~/shared$ ./validate-hw-1.5.sh
{ unauthorizedStatus: {“ok”:0,“errmsg”:“not authorized on admin to execute command { replSetGetStatus: 1.0 }”,“code”:13}, memberStatuses: [“SECONDARY”,“STARTUP”,“STARTUP”], users: 2019-09-20T15:47:06.925+0000 E QUERY [thread1] Error: error: { “ok” : 0, “errmsg” : “not master and slaveOk=false”, “code” : 13435 } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DBCommandCursor@src/mongo/shell/query.js:689:1 DBQuery.prototype._exec@src/mongo/shell/query.js:118:28 DBQuery.prototype.hasNext@src/mongo/shell/query.js:276:5 DBQuery.prototype.toArray@src/mongo/shell/query.js:325:12 @(shell eval):7:22 }
vagrant@database:~/shared$ ./validate-hw-1.5.sh
{ unauthorizedStatus: {“ok”:0,“errmsg”:“not authorized on admin to execute command { replSetGetStatus: 1.0 }”,“code”:13}, memberStatuses: [“SECONDARY”,“STARTUP”,“STARTUP”], users: 2019-09-20T15:51:47.623+0000 E QUERY [thread1] Error: error: { “ok” : 0, “errmsg” : “not master and slaveOk=false”, “code” : 13435 } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DBCommandCursor@src/mongo/shell/query.js:689:1 DBQuery.prototype._exec@src/mongo/shell/query.js:118:28 DBQuery.prototype.hasNext@src/mongo/shell/query.js:276:5 DBQuery.prototype.toArray@src/mongo/shell/query.js:325:12 @(shell eval):7:22 }

i will be very thankful if someone can help me fix this problem.

Best Regards

May be your primary got stepped down
Are 3 mongods up and running?
Are you able to connect to individual nodes?
Did you run rs.initiate() then add other nodes
What does rs.conf(),rs.status() show

1 Like