加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 23:22:25 所属栏目:百科 来源:网络整理
导读:我正在使用rails 3.2和mongoid. 我为设置数据库做了以下步骤: // Add an Admin User (to the admin db)use admindb.addUser("theadmin","anadminpassword")// Use your databaseuse superuser// Add a user (to your database)db.addUser("John","passwordF
我正在使用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服务器:

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

rake sunspot:solr:start
rake sunspot:reindex

2o运行你的种子:

rake db:seed

问候

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读