puppet-mongodb
puppet-mongodb copied to clipboard
Mongo 3.6 : Could not evaluate: Can't connect to any member of replicaset rsmain
Hi,
We are trying to setup the replication using this module but getting following error :
Notice: /Stage[main]/Mongodb::Replset/Mongodb_replset[rsmain]/ensure: created Warning: Can't connect to replicaset member 192.168.33.5:8080. Warning: Can't connect to replicaset member 192.168.33.6:8080. Warning: Can't connect to replicaset member 192.168.33.7:8080. Error: /Stage[main]/Mongodb::Replset/Mongodb_replset[rsmain]: Could not evaluate: Can't connect to any member of replicaset rsmain.
Affected Puppet, Ruby, OS and module versions/distributions
- Puppet: 5.3.2
- Ruby: 2..0.0
- Distribution: Centos 7.4.1708 (Core)
- Module version: 2.1.2
How to reproduce (e.g Puppet code you use)
- Create three AWS EC2 instances with port 8080 open
- Set the replication configuration :
class { 'mongodb::server': auth => false, verbose => true, port => $port, dbpath => $dbpath, logpath => $logpath, service_ensure => stopped, replset => 'rsmain', replset_config => { 'rsmain' => { ensure => present, members => ['192.168.33.5:8080', '192.168.33.6:8080', '192.168.33.7:8080'] } } } - Execute Puppet Apply
What are you seeing
Error: /Stage[main]/Mongodb::Replset/Mongodb_replset[rsmain]: Could not evaluate: Can't connect to any member of replicaset rsmain.
What behaviour did you expect instead
Replication should work
Output log
Please refer to the attached file for debug log Error_Log.txt
Any additional information you'd like to impart
This issue will probably be fixed with this PR: https://github.com/voxpupuli/puppet-mongodb/pull/446
I will try to get it merged (lost sight of this for a while)
EDIT: in hindsight, I'm not sure this is entirely related sorry, you seem to be getting a slightly different error.
Thanks @TomRitserveldt .
This issue is now resolved after changing or removing following line :
service_ensure => stopped to service_ensure => running
But I am facing different problems now with replication:
- If
auth == true, then I am getting following Error :Error: Failed to apply catalog: Could not evaluate MongoDB shell command: load('/root/.mongorc.js'); printjson(db.getMongo().getDBs())
I think, there is already a bug for this : https://github.com/voxpupuli/puppet-mongodb/issues/437
- If
auth == false, If we do following steps : a) Setauth == falseb) Setup the replication c) Enable Authorisation in conf file d) Restart the Mongo Service
Then the replication is working on the First Node but when you will run the code on Second Node then it's failed when it's trying to fetch the replication info from the first node.
Error : {"operationTime"=>1528300824, "ok"=>0, "errmsg"=>"not authorized on admin to execute command { replSetGetStatus: 1.0, $clusterTime: { clusterTime: 1528300824, signature: { hash: 0, keyId: 6563998673095622657 } }, $db: \"admin\" }", "code"=>13, "codeName"=>"Unauthorized", "$clusterTime"=>{"clusterTime"=>1528300824, "signature"=>{"hash"=>0, "keyId"=>"6563998673095622657"}}}
Is there any way to set the replication with the Auth enabled ?
@Dharmender-Singh The error you're getting with auth = false IS related to my PR above, the replica nodes need to run the command to check the db's created with slaveOk(). I haven't tried to setup the cluster with auth enabled as we dont do direct cluster access for users other than the applications(per database) themselves.
Thanks @TomRitserveldt . Will wait for merging your PR..
Hi there, now would be a good time to merge those PS's
btw. it's also valid for clusters with no authentication. @TomRitserveldt
Just curious what the timeframe on this getting resolved is. I am trying to set up a replica set with auth set to true and it fails
Error: /Stage[main]/Mongodb::Replset/Mongodb_replset[main]: Could not evaluate: Can't connect to any member of replicaset rsmain.
Hey there, any news about this ?