【问题标题】:No option for -s (or --server) on start thin - Rails启动瘦时没有-s(或--server)选项 - Rails
【发布时间】:2014-04-01 14:41:22
【问题描述】:

我正在尝试设置多个瘦服务器(在 Windows 上运行 rails),根据我阅读的所有文档,正确的语法是:thin start -s5thin start --server 5。这些都不起作用,我尝试了thin -h 并获得了所有可用的命令,但没有一个(-s / --server)没有出现在列表中。

我使用的是 Thin 1.6.2 代号 Doc Brown

编辑

thin -help 输出:

Server options:
    -a, --address HOST               bind to HOST address (default: 0.0.0.0)
    -p, --port PORT                  use PORT (default: 3000)
    -S, --socket FILE                bind to unix domain socket
    -y, --swiftiply [KEY]            Run using swiftiply
    -A, --adapter NAME               Rack adapter to use (default: autodetect)
                                     (rack, rails, ramaze, merb, file)
    -R, --rackup FILE                Load a Rack config file instead of Rack ada
pter
    -c, --chdir DIR                  Change to dir before starting
        --stats PATH                 Mount the Stats adapter under PATH

SSL options:
        --ssl                        Enables SSL
        --ssl-key-file PATH          Path to private key
        --ssl-cert-file PATH         Path to certificate

Adapter options:
    -e, --environment ENV            Framework environment (default: development
)
        --prefix PATH                Mount the app under PATH (start with /)

Tuning options:
    -b, --backend CLASS              Backend to use, full classname
    -t, --timeout SEC                Request or command timeout in sec (default:
 30)
    -f, --force                      Force the execution of the command
        --max-persistent-conns NUM   Maximum number of persistent connections
                                     (default: 100)
        --threaded                   Call the Rack application in threads [exper
imental]
        --threadpool-size NUM        Sets the size of the EventMachine threadpoo
l.
                                     (default: 20)

Common options:
    -r, --require FILE               require the library
    -q, --quiet                      Silence all logging
    -D, --debug                      Enable debug logging
    -V, --trace                      Set tracing on (log raw request/response)
    -h, --help                       Show this message
    -v, --version                    Show version

【问题讨论】:

  • 这应该是一个选项。 thin --help 说什么?
  • @tadman - 请看我的编辑
  • 您使用的是什么操作系统?我看到了“集群选项”和“守护程序选项”部分,但显然你没有。有时,由于流程模型很难使用,某些功能在 Windows 上不受支持。

标签: ruby-on-rails ruby-on-rails-4 thin


【解决方案1】:

帮助输出缺少可以添加服务器数量作为选项的集群选项

Cluster options:
    -s, --servers NUM                Number of servers to start
    -o, --only NUM                   Send command to only one server of the cluster
    -C, --config FILE                Load options from config file
        --all [DIR]                  Send command to each config files in DIR
    -O, --onebyone                   Restart the cluster one by one (only works with restart command)
    -w, --wait NUM                   Maximum wait time for server to be started in seconds (use with -O)

考虑到这一点,有 2 个选项会为您提供此问题:

  1. Windows 不支持
  2. gem 版本过时

更新

https://github.com/macournoyer/thin/blob/master/lib/thin/runner.rb#L89

 unless Thin.win? # Daemonizing not supported on Windows

更新 2 另一个可能对 Windows 有帮助的选项:

Starting multiple instances of Thin Server on Windows with a batch script

read help start and try this

start /b thin start
and read again help start and play with other options

【讨论】:

  • 1.6.2 是当前版本。
  • 我的是1.6.1,我在Ubuntu上有集群选项,所以可能与windows平台有关。
  • 好的,现在我知道我不能运行多个瘦服务器。问题是(我是 Rails 新手,所以听起来可能有点傻) - 运行单个服务器会有多糟糕?我尝试为这个应用程序使用 helicon zoo,但性能很糟糕。我变瘦了,它运行得非常快。运行单个瘦服务器是否可以接受,还是不能接受?
  • @user3484702 取决于您的应用需求,您也可以在 nginx 上尝试乘客或独角兽,但我不确定它们在 Windows 平台上的表现如何。我现在有一个在单台服务器上运行的应用程序,没关系,顺便说一下,它在 linux 上很薄。关于 windows 平台不能说太多。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-07
  • 1970-01-01
  • 1970-01-01
  • 2015-08-07
  • 1970-01-01
  • 2014-04-02
相关资源
最近更新 更多