我正在尝试连接到MLab上托管的mongodb,但是身份验证失败。
启动我的Rails应用程序时出现错误:
Moped::Errors::AuthenticationFailure: The operation: #<Moped::Protocol::Commands::Authenticate
@length=168
@request_id=3
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="heroku_vjmpxxzn.$cmd"
@skip=0
@limit=-1
@selector={:authenticate=>1, :user=>"heroku_vjmpxxzn", :nonce=>"9a254f9ab71432e4", :key=>"79a149a6651d6e8234e6d45718eff7f0"}
@fields=nil>
failed with error 18: "auth failed"
我已经尝试过更新mongoid版本,但是如果这样做,我将需要更新许多其他gem,这将花费大量时间。
这是我的mongoid.yml
生产配置。
production:
sessions:
default:
database: <database>
username: <user>
password: <pass>
hosts:
- ds333748-a0.mlab.com:33748
- ds333748-a1.mlab.com:33748
options:
consistency: :strong
skip_version_check: true
safe: true
我正在使用:
Gemfile
source 'https://rubygems.org'
ruby "2.3.8"
gem 'rails', '3.2.22.5'
gem 'rest-client'
gem 'bundler', '1.15.2'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# Gems used only for assets and not required
# in production environments by default.
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem "cpf_cnpj"
gem "savon"
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'uglifier', '>= 1.0.3'
gem 'adminlte2-rails'
gem 'jquery-rails'
gem 'will_paginate_mongoid'
gem "mongo_session_store-rails3"
gem 'geocoder', '1.3.3'
gem 'test-unit'
gem 'nokogiri'
gem 'sprockets', '~> 2'
gem "httparty", '0.13.3'
gem 'mongoid-geospatial'
gem 'credit_card_validations'
gem "chartkick"
gem "time_difference"
gem 'newrelic_rpm'
gem 'dropzonejs-rails'
gem 'mongoid_auto_increment', :git => 'git://github.com/teriyakisan/mongoid_auto_increment.git'
gem 'parse-ruby-client', git: 'https://github.com/adelevie/parse-ruby-client.git', ref: '98596a04dfc30295c1d078c58c31b4cea299e8ca'
gem 'websocket-rails', github: 'moaa/websocket-rails', branch: 'threadsocket-rails'
gem 'websocket-rails-js', github: 'websocket-rails/websocket-rails-js', branch: 'sub_protocols'
gem 'faye-websocket', '0.10.0'
gem 'momentjs-rails'
gem "pagarme"
gem "mongoid", ">= 3.1.0"
gem "paperclip", ' 3.1.1'
gem "mongoid-paperclip", :require => "mongoid_paperclip"
gem 'aws-sdk', '< 3.0'
gem "google-api-client"
gem "cucumber-rails", ">= 1.3.0", :group => :test, :require => false
gem 'apipie-rails'
gem "devise", ">= 2.2.3"
gem "quiet_assets", ">= 1.0.1", :group => :development
gem "figaro", ">= 0.5.3"
gem "better_errors", ">= 0.6.0", :group => :development
gem "binding_of_caller", ">= 0.6.9", :group => :development
gem 'client_side_validations'
gem 'fcm'
gem 'redis'
gem 'rack-cors'
gem 'certified'
group :production do
gem 'thin'
end
答案 0 :(得分:1)
很抱歉,但Mongoid 3.1于2013年发布,而mongodb 3.4于3年后于2016年发布...有点道理,它将无法正常工作... 您是否考虑过升级蒙古包?或变老的mongodb?
如果无法更改版本,则可以尝试仅升级mongo驱动程序(bundle update mongo
)并查看会发生什么情况。