微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – 连接被拒绝 – 用Mongkeb上的rake db:seed连接(2)

我正在使用rails 3.2和mongoid.

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

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

问候

原文地址:https://www.jb51.cc/ruby/264707.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐