Connection refused - connect(2) with rake db:seed on Mongodb

馋奶兔 提交于 2020-01-12 19:38:35

问题


I am using rails 3.2 and mongoid.

I make these steps for setting my database:

// 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)

In my mongo.yml I have:

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

You can see in http://www.mongodb.org/display/DOCS/Security+and+Authentication

My problem is that now I try run:

rake db:seed

I get now this error:

rake aborted!
Connection refused - connect(2)

How can I fix it?


回答1:


The problem was fixed:

The problem was with solr server:

If you have solr server in your project:

1º Make sure that the Solr server is started before you seed:

rake sunspot:solr:start
rake sunspot:reindex

2º Run your seed:

rake db:seed

Regards



来源:https://stackoverflow.com/questions/11030418/connection-refused-connect2-with-rake-dbseed-on-mongodb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!