views:

535

answers:

1

Hi all

I'm very new to Ruby on Rails so please go easy! I've uploaded the whole application to the server (Dreamhost) and gone through the steps. But when I try to run it I get the following error:

failed to connect to any given host:port (Mongo::ConnectionFailure)

I have installed the Mongo gem; but maybe I haven't got it configured correctly? I know you can't use localhost for describing where a Dreamhost mysql database is; might it be something like that?

These are the first five lines of the backtrace if that helps?:

    /home/user/.gem/ruby/1.8/gems/mongo-0.19.1/lib/../lib/mongo/connection.rb   440 in `connect_to_master'
1   /home/user/.gem/ruby/1.8/gems/mongo-0.19.1/lib/../lib/mongo/connection.rb   131 in `initialize'
2   /home/user/.gem/ruby/1.8/gems/magent-0.3/lib/magent.rb  19  in `new'
3   /home/user/.gem/ruby/1.8/gems/magent-0.3/lib/magent.rb  19  in `connection'
4   /home/user/.gem/ruby/1.8/gems/magent-0.3/lib/magent.rb  27  in `database='
5   /home/user/.gem/ruby/1.8/gems/magent-0.3/lib/magent.rb  35  

Any help much appreciated and apologies for my n00bishness! Thanks.

+1  A: 

It looks like you are trying to connect to a MySQL database using Mongo (since you mentioned that Dreamhost uses MySQL), so there is something wrong with your database configuration.

I am not aware of the correct information for Dreamhost, but make sure that your config/database.yml looks like this:

production:
  adapter: mysql
  database: <insert database name>
  host: <insert database host>
  user: <insert database username>
  password: <insert database password>
Jimmy Stenke
Thanks. I've done that and unfortunately still not working!
Sam Hursey
hmm, is it still the same error or another one? You changed the production entry (make sure that you have no other entries there as well, there is no need for those in production and will help minimizing the wrong connections)?
Jimmy Stenke
It would appear that the app doesn't work at all with mySQL! Sorry for that; your info was right though if it had worked!
Sam Hursey