我在本地安裝了MongoDB,並試圖在Rails 4/Ruby 1.9.3/Windows 7上使用Mongoid/Moped時出現此錯誤:Mongoid with Rails 4 - 無法連接到主節點... resolved_address = nil
"Could not connect to a primary node for replica set #<Moped::Cluster:27191916 @seeds=[<Moped::Node resolved_address=nil>]>"
從resolved_address可能造成=零 - 其他論壇指出,這是從hosts文件一個錯字 - 在這個文件位於Windows中的任何想法?
應用程序只包含一個簡單的模型「文章」
class Article
include Mongoid::Document
field :name, type: String
field :content, type: String
end
和異常在Articles.all.each.do |article|
抓...
運行的mongod和蒙戈外殼做工精細的APP-所以我之外假設它的東西與配置...我的Rails服務器記錄吐出來的是以下幾點:
Started GET "/articles" for 127.0.0.1 at 2014-01-14 19:04:18 -0800
Processing by ArticlesController#index as HTML
MOPED: Could not resolve IP for: localhost:27017 runtime: n/a
MOPED: Retrying connection attempt 1 more time(s). runtime: n/a
MOPED: Could not resolve IP for: localhost:27017 runtime: n/a
Rendered articles/index.html.erb within layouts/application (10294.6ms)
Completed 500 Internal Server Error in 10325ms
據我所知,我沒有做副本集東西。
Rails.env是development
和我的配置文件(mongoid.yml)是:
development:
sessions:
default:
database: mid_dev
hosts:
- localhost:27017
options:
options:
Mongoid可能沒有正式準備好軌道4 - 但是有任何人任何運氣跨越這個障礙?
我做'User.count'當面臨來自'軌console'同樣的問題(對數據庫做任何查詢)。和'rails server'工作正常,它奇怪的問題錯誤:「Moped :: Node resolved_address = nil」。 –