首页 文章

Rails服务器突然停止使用Mysql并且无法连接

提问于
浏览
0

我正在铁轨上学习红宝石 . wile构建一个小应用程序,服务器已断开连接,不会再连接 .

使用:

rails server

我在app目录中 . (双重,三重检查......) .

连接到服务器一段时间工作完美,然后停止 .

我正在使用Mysql .

Rails服务器在我正在处理的其他应用程序上启动完全正常 .

这些是我的版本:

root@R://# ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
root@R://# rails -v
Rails 4.2.1

和mysql版本:

+-------------------------+-------------------------+ | Variable_name | Value | +-------------------------+-------------------------+ | innodb_version | 5.5.43 | | protocol_version | 10 | | slave_type_conversions | | | version | 5.5.43-0ubuntu0.14.04.1 | | version_comment | (Ubuntu) | | version_compile_machine | x86_64 | | version_compile_os | debian-linux-gnu | +-------------------------+-------------------------+

这是输出

rails server

root@R://home/ruby/Projects/SempleApp# rails server => Booting WEBrick => Rails 4.2.1 application starting in development on http://localhost:3000 => Run rails服务器-h for more startup options => Ctrl-C to shutdown server Exiting

我的database.yml文件设置正常,自服务器连接后我没有更改它 .

我重新启动了Mysql服务 . 重新启动终端并重新启动整个计算机..这个应用程序仍然无法连接到服务器其他应用程序可以..

我被卡住了......在任何地方找不到答案 . 救命...

PS-这是我在这里的第一个问题 . 希望我给出了正确的信息 .

谢谢

完整错误:

root@ruby-man://home/ruby/Projects/TweetrWork# rails server => Booting WEBrick => Rails 4.2.1 application starting in development on http://localhost:3000 => Run rails server -h for more startup options => Ctrl-C to shutdown server Exiting /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in load': /home/ruby/Projects/TweetrWork/config/routes.rb:60: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError) from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:inblock in load' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in load_dependency' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:inload' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in block in load_paths' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:ineach' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:40:in load_paths' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:16:inreload!' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:26:in block in updater' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:incall' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/file_update_checker.rb:75:in execute' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:27:inupdater' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/routes_reloader.rb:7:in execute_if_updated' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/finisher.rb:69:inblock in ' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:in instance_exec' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:30:inrun' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:55:in block in run_initializers' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:226:inblock in tsort_each' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:348:in block (2 levels) in each_strongly_connected_component' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:429:ineach_strongly_connected_component_from' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:347:in block in each_strongly_connected_component' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:ineach' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in call' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:ineach_strongly_connected_component' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:224:in tsort_each' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:203:intsort_each' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/initializable.rb:54:in run_initializers' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application.rb:352:ininitialize!' from /home/ruby/Projects/TweetrWork/config/environment.rb:5:in <top (required)>' from /home/ruby/Projects/TweetrWork/config.ru:3:inrequire' from /home/ruby/Projects/TweetrWork/config.ru:3:in block in <main>' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:ininstance_eval' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in initialize' from /home/ruby/Projects/TweetrWork/config.ru:innew' from /home/ruby/Projects/TweetrWork/config.ru:in <main>' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:ineval' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in new_from_string' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:inparse_file' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in build_app_and_options_from_config' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:inapp' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:61:in app' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:inwrapped_app' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:139:in log_to_stdout' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/server.rb:78:instart' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:80:in block in server' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:intap' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:75:in server' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:inrun_command!' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/commands.rb:17:in <top (required)>' from /home/ruby/Projects/TweetrWork/bin/rails:8:inrequire' from /home/ruby/Projects/TweetrWork/bin/rails:8:in <top (required)>' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:inload' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/rails.rb:28:in call' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client/command.rb:7:incall' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/client.rb:26:in run' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/bin/spring:48:in' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in load' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/binstub.rb:11:in' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require' from /home/ruby/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire' from /home/ruby/Projects/TweetrWork/bin/spring:13:in <top (required)>' from bin/rails:3:inload' from bin/rails:3:in'`

1 回答

  • 0

    答案在这里:

    4.2.1/lib/active_support/dependencies.rb:268:in load': /home/ruby/Projects/TweetrWork/config/routes.rb:60: syntax error, unexpected end-of-input, **expecting keyword_end (SyntaxError)**
    

    这是代码中的拼写错误 . 正如Prashant4224所写,在 /home/ruby/Projects/TweetrWork/config/routes.rb 中的正确位置添加结束应该可以解决问题

相关问题