连接被拒绝 - 连接(2)与rake db:种子在Mongodb [英] Connection refused - connect(2) with rake db:seed on Mongodb

查看:127
本文介绍了连接被拒绝 - 连接(2)与rake db:种子在Mongodb的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 rails 3.2 mongoid



我设置我的数据库的这些步骤:

  //添加管理员用户b使用admin 
db.addUser(theadmin,anadminpassword)

//使用您的数据库
使用超级用户

//添加用户(到你的数据库)
db.addUser(John,passwordForJohn)

//显示所有用户:
db.system.users.find b
$ b // 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



我的问题是,现在我试试run :

  rake db:seed 

我得到这个错误:

  rake aborted! 
连接拒绝 - 连接(2)

如何解决?

解决方案

问题修复了:



问题是使用solr server: p>

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



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

  rake sunspot:solr:start 
rake sunspot:reindex

2º运行您的种子:

  rake db:seed 

尊敬


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?

解决方案

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

这篇关于连接被拒绝 - 连接(2)与rake db:种子在Mongodb的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆