I keep getting the following error when trying to connect to the mongodb replica set. I can not understand this problem here.
2.2.0 :026 > require 'mongo' 2.2.0 :026 > client = Mongo::Client.new(["#{DB[:host]}:#{DB[:port]}"], 2.2.0 :027 > :database => DB[:name], 2.2.0 :028 > :replica_set => DB[:replica_set], 2.2.0 :029 > :user => DB[:user], 2.2.0 :030 > :password => DB[:password]) D, [2016-01-27T18:20:47.883886
I can access the replica set using the mongo command from bash
mongo mydb --host mongo-replica-1 --port 27028 --username myuser --password mypass
with the command above, I can access mongo and run the read data after launch
> db.setSlaveOk()
But I can’t even connect in the first case, it seems that it is connected, but continue to receive the message “execution has expired”.
source share