mongod runs with command but not with config file
That error message "not master and slaveOk=false" is what you get when you try to query on a secondary server. If you're getting that message, that implies that:


The server has successfully started
The server has successfully joined the replica set
A different server is currently Primary


You should be able to check that by running rs.status() in the shell (assuming your user account has replicaset administration privileges).

If you want to run a query on this server to confirm that it is working (even though it is currently a secondary), you can use the rs.slaveOk call.