Has anyone been able to connect to a MongoDB replica set using rmongodb
? No matter how I configure mongo.create
I get an authentication error, even though the same host/username/password work fine when connecting via the mongo
shell.
My code does the equivalent of:
> mongo.create(c("rs-1.mysite.com:12345","rs-2.mysite.com:12345"), "rsName", "user", "password", "my_db")
Unable to connect to replset
Authentication failed.
Update:
Looking at the logs of all the nodes in the replica set, I do not see any attempt to authenticate when I run the code above. Therefore, this may be a rmongodb
bug.
As Sim has noted, rmongodb 1.0.3 does not resolve hostnames.
It is, however, possible to connect to replica sets from rmongodb with with a few caveats:
So my working connect string looks like:
mongo.create(c("192.168.1.123:27017","192.168.1.124:27018","192.168.1.125:27017"),"","user","password", "thedb")
NB: I only tested this with MongoDB 2.2.0.