MongoDB Mongo::ReplSetConnection authenticate 错误

tommy · 2012年10月17日 · 最后由 tommy 回复于 2012年10月18日 · 2273 次阅读

这个是脚本 require 'mongo' database=Mongo::ReplSetConnection.new(["database1:9900", "database2:9900", "database3:9900"]).db("project") database.authenticate("user","passwd")

运行后出现如下的错误。 NameError: undefined local variable or method pools' for #<Mongo::ReplSetConnection:0x0000000441e610>   from /home/tommy/.rvm/gems/ruby-1.9.3-p194@myrails3/gems/mongo-1.7.0/lib/mongo/repl_set_connection.rb:309:inauthenticate_pools'

有人遇到过吗?

找到了一个暂时的解决方案 con=Mongo::ReplSetConnection.new(["host1:14000", "host2:14000", "host3:14000"]) con.add_auth("databasename","user","passwd") con.apply_saved_authentication()

需要 登录 后方可回复, 如果你还没有账号请 注册新账号