连接被拒绝 - 与耙分贝(2)连接:种子有关MongoDB(Connection refused -

2019-07-29 22:24发布

我使用的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)

我怎样才能解决这个问题?

Answer 1:

该问题得到了解决:

问题是使用Solr服务器:

如果你在你的项目的Solr服务器:

1º请确保您之前的种子Solr的服务器启动:

rake sunspot:solr:start
rake sunspot:reindex

2º运行你的种子:

rake db:seed

问候



文章来源: Connection refused - connect(2) with rake db:seed on Mongodb