Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Mongo::ConnectionFailure when pushing to EC2 #319

Open
holgersindbaek opened this Issue · 15 comments

7 participants

@holgersindbaek

Whenever I try to push to rubber, following the railscast tutorial - http://railscasts.com/episodes/347-rubber-and-amazon-ec2 - to the point, it fails the push with this command:

** [out :: production.foo.com] /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongo-1.3.1/lib/mongo/connection.rb:518:in `connect': Failed to connect to a master node at production.foo.com:27017 (Mongo::ConnectionFailure)

I don't even use Mongo, I set the app up with postgresql and vulcanized with postgres as well.

This other people have had this issue before - #266 - but they weren't that good at explaining themselves.

This is the full stacktrace (beginning from the error):

 ** [out :: production.foo.com] /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongo-1.3.1/lib/mongo/connection.rb:518:in `connect': Failed to connect to a master node at production.foo.com:27017 (Mongo::ConnectionFailure)
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongo-1.3.1/lib/mongo/connection.rb:656:in `setup'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongo-1.3.1/lib/mongo/connection.rb:101:in `initialize'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongo-1.3.1/lib/mongo/connection.rb:152:in `new'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongo-1.3.1/lib/mongo/connection.rb:152:in `from_uri'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config/database.rb:89:in `master'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config/database.rb:22:in `configure'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config.rb:273:in `configure_databases'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config.rb:94:in `from_hash'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config.rb:109:in `block in load!'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config.rb:108:in `tap'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/config.rb:108:in `load!'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid.rb:147:in `load!'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/mongoid-2.4.5/lib/mongoid/railtie.rb:84:in `block in <class:Railtie>'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
 ** [out :: production.foo.com] from /usr/local/graylog2-web-interface-0.9.6p1/config/environment.rb:6:in `<top (required)>'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands/runner.rb:40:in `<top (required)>'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:63:in `require'
 ** [out :: production.foo.com] from /usr/local/rubies/1.9.3-p392/lib/ruby/gems/1.9.1/gems/railties-3.1.3/lib/rails/commands.rb:63:in `<top (required)>'
 ** [out :: production.foo.com] from ./script/rails:6:in `require'
 ** [out :: production.foo.com] from ./script/rails:6:in `<main>'
    command finished in 35898ms
failed: "/bin/bash -l -c 'sudo -p '\\''sudo password: '\\''  bash -l /tmp/bootstrap_graylog_web'" on production.foo.com
@SegFaultAX
Collaborator

Well you are depending on mongo since you're using graylog (I'm assuming that you vulcanized with one of the _complete templates). You need to add mongo to that node and re-bootstrap so graylog can properly initialize itself.

@holgersindbaek

@SegFaultAX No I'm not. I'm using Postgrest and I'm vulcanixing using:

rubber vulcanize complete_passenger_postgresql

After that, graylog is automatically added to the gems. Am I doing something wrong here?

@SegFaultAX
Collaborator

Please note from the graylog template configuration:

description: The graylog log aggregation and search module
dependent_templates:
  - mongodb
  - elasticsearch
@holgersindbaek

@SegFaultAX Ok... what does that mean? That I should take away graylog from the gemfile?

I've just tried to push using your quickstart guide and I get the same result. It would be great if you could update your quickstart, with the necessary steps. I'd love to get going with this awesome gem!

@holgersindbaek

@SegFaultAX Seems like these guys also has the same problem (just on ubuntu):

#239

@holgersindbaek

If I do cap deploy afterwards, then it deploys and works fine, but this issue should probably be fixed.

@SegFaultAX
Collaborator

/cc @wr0ngway

@samgrimm

I am having the same problem, except the blog application (as in the railscast and the quick start guide) will not work after cap deploy. It looks like it does at first glance, but the tail logs show
Error: Port conflict: another instance is already running on /var/run/postgresql with port 5432

Thanks!

@HaasEffect

Same problem here. If I run "cap deploy" after a failed "cap rubber:create_staging" deployment I'll get the following error:

** [out :: production.blog.com] rake aborted!
** [out :: production.blog.com] could not connect to server: Connection refused
** [out :: production.blog.com] Is the server running on host "production.blog.com" (10.210.xxx.xx) and accepting
** [out :: production.blog.com] TCP/IP connections on port 5432?

This happens when I try to start the postgresql server to solve this problem:
ubuntu@production:~$ sudo /etc/init.d/postgresql start

  • Starting PostgreSQL 9.1 database server * Error: /mnt/postgresql/9.1/data is not accessible or does not exist

Any other ideas how to fix this Mongo::ConnectionFailure? The last time I deployed (4-5 months ago everything worked like a charm). Updated to latest rubber version.

@HaasEffect

Regarding the Mongo::ConnectionFailure problem:
I found this on stackoverflow: http://stackoverflow.com/questions/4837427/mongo-ruby-connection-problem . This could be related to this problem - so I guess mongodb is not running.

@toptierlabs

Any news related to this problem?

@kschutt

Any progress here?

@nirvdrum
Owner

I don't think this is an issue any longer. We've upgraded to graylog 0.20.x in Rubber and that version no longer uses a Rails app for the front-end. Mongo is still in use, but this whole bootstrapping problem should have gone away. If any of you could confirm, that'd be helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.