连接被拒绝 – 在Mongodb上使用rake db:seed连接(2)

我正在使用rails 3.2mongoid

我为设置数据库做了以下步骤:

 // Add an Admin User (to the admin db) use admin db.addUser("theadmin", "anadminpassword") // Use your database use superuser // Add a user (to your database) db.addUser("John", "passwordForJohn") // show all users: db.system.users.find() // add readonly user (kinda cool) db.addUser("readonly", "passwordForJohn", true) 

在我的mongo.yml我有:

 production: host: localhost port: 27017 username: John password: passwordForJohn database: namedatabase 

您可以在http://www.mongodb.org/display/DOCS/Security+and+Authentication中看到

我的问题是现在我尝试运行:

 rake db:seed 

我现在得到这个错误:

 rake aborted! Connection refused - connect(2) 

我该如何解决?

问题得到解决:

问题出在solr服务器上:

如果您的项目中有solr服务器:

1º确保在播种前启动Solr服务器:

 rake sunspot:solr:start rake sunspot:reindex 

2º运行你的种子:

 rake db:seed 

问候