0

簡単な質問があります。Iamはrailsとherokuも初めてです。最近、次のgitリポジトリgit://github.com/barmstrong/ribbot.gitからオープンソースコードをダウンロードしました。私はmongodbで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:11211Mongoドライバー構成のどこかにハードコーディングされているかMONGOLAB_URI、環境からの値を使用するように指定していないと思われます。

MongoLabアドオンドキュメントについては、こちらをご覧ください:https ://devcenter.heroku.com/articles/mongolab環境変数からの値の使用に関するセクションはこちらです:https ://devcenter.heroku.com/articles/mongolab# connected_your_heroku_application_to_your_mongodb_databaseであり、ドライバー固有です。

お役に立てば幸いです。

于 2012-04-18T15:09:28.187 に答える