0

我有一个快速的问题。我也是rails和heroku的新手。我最近从以下 git 存储库 git://github.com/barmstrong/ribbot.git 下载了一个开源代码。我正在使用 mongo db 运行 rails 并设置了环境。决定使用 heroku 作为我的服务器解决方案,我已经在 mongoLAB 上下载了插件,但是当我尝试运行代码时,出现以下错误。但是,我可以在本地机器上顺利运行它。

2012-04-16T22:51:04+00:00 heroku[api]: Add-on add mongolab:starter by *******@hotmail.com
2012-04-16T22:51:04+00:00 heroku[api]: Release v2 created by *******@hotmail.com
2012-04-16T22:51:21+00:00 heroku[slugc]: Slug compilation started
2012-04-16T22:53:20+00:00 heroku[api]: Add-on add shared-database:5mb by *******@hotmail.com
2012-04-16T22:53:20+00:00 heroku[api]: Release v3 created by *******@hotmail.com
2012-04-16T22:53:21+00:00 heroku[api]: Config add RAILS_ENV, LANG, PATH, RACK_ENV, GEM_PATH by *******@hotmail.com
2012-04-16T22:53:21+00:00 heroku[api]: Release v4 created by *******@hotmail.com
2012-04-16T22:53:21+00:00 heroku[api]: Release v5 created by *******@hotmail.com
2012-04-16T22:53:21+00:00 heroku[api]: Deploy fe1b768 by *******@hotmail.com
2012-04-16T22:53:21+00:00 heroku[web.1]: State changed from created to starting
2012-04-16T22:53:22+00:00 heroku[slugc]: Slug compilation finished
2012-04-16T22:53:34+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 44817`
2012-04-16T22:54:06+00:00 app[web.1]: [2012-04-16 22:54:06] INFO  WEBrick 1.3.1
2012-04-16T22:54:06+00:00 app[web.1]: [2012-04-16 22:54:06] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2012-04-16T22:54:06+00:00 app[web.1]: [2012-04-16 22:54:06] INFO  WEBrick::HTTPServer#start: pid=1 port=44817
2012-04-16T22:54:08+00:00 heroku[web.1]: State changed from starting to up
2012-04-16T22:54:57+00:00 app[web.1]: => Booting WEBrick
2012-04-16T22:54:57+00:00 app[web.1]: => Rails 3.1.1 application starting in production on http://0.0.0.0:44817


2012-04-16T22:54:57+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-04-16T22:54:57+00:00 app[web.1]: localhost:11211 failed (count: 0)
2012-04-16T22:54:57+00:00 app[web.1]: 
2012-04-16T22:54:57+00:00 app[web.1]: 
2012-04-16T22:54:57+00:00 app[web.1]: Started GET "/" for 208.124.140.154 at 2012-04-16 22:54:57 +0000
2012-04-16T22:54:58+00:00 app[web.1]: cache: [GET /] miss
2012-04-16T22:54:58+00:00 app[web.1]:   Processing by PostsController#index as HTML
2012-04-16T22:54:58+00:00 app[web.1]: Redirected to http://herokuapp.com/forums
2012-04-16T22:54:58+00:00 app[web.1]: Completed 302 Found in 114ms
2012-04-16T22:54:58+00:00 heroku[router]: GET impact-project.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=885ms status=302 bytes=93
2012-04-16T22:55:14+00:00 app[web.1]: localhost:11211 failed (count: 1)
2012-04-16T22:55:14+00:00 app[web.1]: localhost:11211 is down
2012-04-16T22:55:14+00:00 app[web.1]: 
2012-04-16T22:55:14+00:00 app[web.1]: 
2012-04-16T22:55:14+00:00 app[web.1]: Started GET "/" for 208.124.140.154 at 2012-04-16 22:55:14 +0000
2012-04-16T22:55:14+00:00 app[web.1]: cache: [GET /] miss
2012-04-16T22:55:14+00:00 app[web.1]:   Processing by PostsController#index as HTML
2012-04-16T22:55:14+00:00 app[web.1]: Redirected to http://herokuapp.com/forums
2012-04-16T22:55:14+00:00 app[web.1]: Completed 302 Found in 11ms
2012-04-16T22:55:14+00:00 heroku[router]: GET impact-project.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=528ms status=302 bytes=93
2012-04-16T22:55:57+00:00 app[web.1]: localhost:11211 failed (count: 2)
2012-04-16T22:55:57+00:00 app[web.1]: 
2012-04-16T22:55:57+00:00 app[web.1]: 
2012-04-16T22:55:57+00:00 app[web.1]: Started GET "/" for 208.124.140.154 at 2012-04-16 22:55:57 +0000
2012-04-16T22:55:57+00:00 app[web.1]: cache: [GET /] miss
2012-04-16T22:55:57+00:00 app[web.1]:   Processing by PostsController#index as HTML
2012-04-16T22:55:57+00:00 app[web.1]: Redirected to http://herokuapp.com/forums
2012-04-16T22:55:57+00:00 app[web.1]: Completed 302 Found in 4ms
2012-04-16T22:55:57+00:00 heroku[router]: GET impact-project.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=549ms status=302 bytes=93
4

1 回答 1

1

我怀疑您localhost:11211在 Mongo 驱动程序配置中的某个地方进行了硬编码,或者没有指定使用MONGOLAB_URI环境中的值。

有关 MongoLab 附加文档,请参见此处:https ://devcenter.heroku.com/articles/mongolab关于使用环境变量中的值的部分在这里:https ://devcenter.heroku.com/articles/mongolab# connecting_your_heroku_application_to_your_mongodb_database并且是特定于驱动程序的。

希望有帮助。

于 2012-04-18T15:09:28.187 回答