ruby-on-rails – 使用worker启动Puma服务器时出错

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 使用worker启动Puma服务器时出错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是Rails和Puma的新手,因此简单的解决方案可能过于愚蠢,如果你认为我做错了什么,请指导我.

我正在尝试与工人一起为我的轨道启动Puma服务器.如果我将工人设置为0

puma -w0

服务器启动完美,但如果我将worker设置为1或更多,则会出现以下错误

E:\RoR_tryouts\ws_13.11.13\todo>puma -w3
[2120] *** SIGUSR2 not implemented,signal based restart unavailable!
[2120] *** SIGUSR1 not implemented,signal based restart unavailable!
[2120] Puma starting in cluster mode...
[2120] * Version 2.7.1,codename: Earl of Sandwich Partition
[2120] * Min threads: 0,max threads: 16
[2120] * Environment: development
[2120] * Process workers: 3
[2120] * Phased restart available
[2120] * Listening on tcp://0.0.0.0:9292

C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/lib/puma/cluster.rb:229:in `trap': unsupported signal SIGCHLD (ArgumentError)
        from C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/lib/puma/cluster.rb:229:in `run'
        from C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/lib/puma/cli.rb:442:in `run'
        from C:/Ruby/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.7.1/bin/puma:10:in `<top (required)>'
        from C:/Ruby/Ruby193/bin/puma:23:in `load'
        from C:/Ruby/Ruby193/bin/puma:23:in `<main>'

产品规格:

> Windows 7
> Ruby 1.9.3p448(2013-06-27)[i386-mingw32] MRI Rail 4.0.0 Puma
> 2.7.1版,代号:三明治分区伯爵

解决方法

the Puma README引用:

Because of varIoUs platforms not being implement certain things,the following differences occur when Puma is used on different platforms:

  • JRuby,Windows: server sockets are not seamless on restart,they must be closed and reopened. These platforms have no way to pass descriptors into a new process that is exposed to ruby
  • JRuby,Windows: cluster mode is not supported due to a lack of fork(2)
  • Windows: daemon mode is not supported due to a lack of fork(2)

正如它明确指出的那样,Windows不支持集群模式(即运行具有多个worker的单个puma实例)和守护进程模式(在启动后从shell分离).

您应该使用differt操作系统(例如Linux)或在单工作模式下使用Puma.您可以手动启动不同端口上的多个Puma实例,并在它们之间实现负载均衡,即使在Windows上也是如此.你只需要一个前端负载均衡器,它不像Puma内置的本机集群模式那样无缝.

猜你在找的Ruby相关文章