【问题标题】:Connection refused - connect(2) with rake db:seed on Mongodb连接被拒绝 - 在 Mongodb 上使用 rake db:seed 连接(2)
【发布时间】:2023-03-16 17:51:01
【问题描述】:

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

我该如何解决?

【问题讨论】:

    标签: ruby-on-rails mongodb ruby-on-rails-3 mongoid database


    【解决方案1】:

    问题已解决:

    问题出在 solr 服务器上:

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

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

    rake sunspot:solr:start
    rake sunspot:reindex
    

    2º 运行你的种子:

    rake db:seed
    

    问候

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-08
      相关资源
      最近更新 更多