我正在使用Apache Proxy balancer指令来连接一组瘦服务器(用于Rails).
像这样:
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000 route=thin0
BalancerMember http://127.0.0.1:5001 route=thin1
BalancerMember http://127.0.0.1:5002 route=thin2
</Proxy>
Run Code Online (Sandbox Code Playgroud)
但是,thin也可以配置为使用unix域套接字.
所以我希望能够做到这样的事情:
<Proxy balancer://thinservers>
BalancerMember unix://tmp/thin.0.sock route=thin0
BalancerMember unix://tmp/thin.1.sock route=thin1
BalancerMember unix://tmp/thin.2.sock route=thin2
</Proxy>
Run Code Online (Sandbox Code Playgroud)
但Apache没有接受它.显然nginx可以做到,但我真的想使用Apache.
有办法吗?
我的黄瓜使用默认的Webrick服务器进行selenium运行(对于Rails 3应用程序).
如何强制或设置与Thin服务器而不是Webrick一起运行?要放入env.rb文件的任何设置还是其他?
我是个新手.我在rails应用程序上有一个ruby.今天我可以通过命令正常启动应用程序
sudo thin start -d
Run Code Online (Sandbox Code Playgroud)
我们已经为测试创建了一个新数据库.(一个是干净的数据库,而另一个是用于测试,因此可以搞砸)在database.yml文件上.
我想使用不同的数据库在两个不同的端口启动相同的应用程序.
要使用数据库启动应用程序,我可以使用thin的ENV选项:
sudo thin start -d -e production -p 3040
Run Code Online (Sandbox Code Playgroud)
它很好.但是,当我尝试启动"常规"服务器时,它说已经运行了.我怎么能在ame thin命令中启动这两个应用程序.有没有办法为此制作配置文件?
可能重复:
'ab'程序在很多请求后冻结,为什么?
这是一个简单的测试服务器:
require 'rubygems'
require 'rack'
require 'thin'
class HelloWorld
def call(env)
[200, {"Content-Type" => "text/plain"}, "OK"]
end
end
Rack::Handler::Thin.run HelloWorld.new, :Port => 9294
#I've tried with these added too, 'rack.multithread' => true, 'rack.multiprocess' => true
Run Code Online (Sandbox Code Playgroud)
这是一个测试运行:
$ ab -n 20000 http://0.0.0.0:9294/sdf
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 0.0.0.0 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed …Run Code Online (Sandbox Code Playgroud) 对于应用程序服务器(Passenger,Thin,Unicorn,Mongrel,Puma和Rainbows!)有这么多选择,我想知道什么适合以下场景:
Rails纯粹用于API后端(所有资产都与Nginx一起提供).某些API调用依赖于其他API服务,因此有时需要一段时间才能完成.
响应式应用程序用于移动,平板电脑和桌面客户端,因此无法保证客户端的连接.
在这种情况下,您认为哪种应用服务器是合适的?选择时应该考虑哪些事项?
你可以用thin与ActionController::Live实现服务器端的事件(SSE)和长轮询?如果是这样,怎么样?
虽然标题是如何获取Rails 4 ActionController :: Live流与Thin和Ruby 2一起使用的重复?Thin和Puma如何通过直播流扩展?OP通过提出两个问题来混淆水域,这个问题从未得到回答.
thin如果你通过exec thin start --threaded以下方式启动它,许多其他帖子建议你可以用于服务器端事件(sse):Heroku是否支持ActionController :: Live?和Puma只有多线程导轨4 http服务器?,Aaron的开创性建筑http://tenderlovemaking.com/2012/07/30/is-it-live.html和Ryan常年可靠的http://railscasts.com/episodes/401-actioncontroller-live?view=asciicast.但即使我正在复制Railscast示例,我也无法使用它thin.
# ----------------------------------------------------------------
# file: config/routes.rb
Rails.application.routes.draw do
resources :widgets do
collection do
get 'events' # SSE test
end
end
end
Run Code Online (Sandbox Code Playgroud)
_
# ----------------------------------------------------------------
# file: config/environments/development.rb
Rails.application.configure do
... snip ...
# see http://tenderlovemaking.com/2012/07/30/is-it-live.html
config.preload_frameworks = true
config.allow_concurrency = true
end …Run Code Online (Sandbox Code Playgroud) bundle exec thin start -p 3111 给出以下输出:
使用机架适配器瘦Web服务器(v1.2.11代号Bat-Shit Crazy)最大连接数设置为1024听取0.0.0.0:3111,CTRL + C停止^ C
Ctrl-C不执行任何操作(SIGINT).也没有杀死(SIGTERM).
我发现了一些这种行为的引用,但没有解决方案.问题似乎是在eventmachine(捆绑了最新的thin),ruby 1.9.2-r290或linux内核(Ubuntu 10.4 LTS,2.6.38.3-linode32)中.
它发生在我的项目中,但不是一个全新的rails项目.
参考文献:
我已经建立了一个运行Rails 3.1.0rc6,Thin和Nginx的生产环境.
出于某种原因,将其具有config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"的config/environments/production.rb,Rails的似乎完全忽略它; 资产未被提供,一个文件的响应标头如下:
Server: nginx/1.0.5
Date: Sun, 28 Aug 2011 00:26:08 GMT
Content-Type: image/png
Content-Length: 0
Cache-Control: no-cache
Last-Modified: Sat, 27 Aug 2011 23:47:35 GMT
Etag: "af4810c52cb323d9ed061d1db5b4f296"
X-UA-Compatible: IE=Edge,chrome=1
X-Sendfile: /var/www/***/app/assets/images/bg-linen-light.png
X-Runtime: 0.004595
X-Content-Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709
Age: 0
X-Rack-Cache: stale, valid, store
200 OK
Run Code Online (Sandbox Code Playgroud)
所以似乎Rails仍在设置X-Sendfile标题.我已经尝试添加sendfile_header行config/application.rb,但我猜它正在被覆盖或被忽略.
我的瘦身yml文件:
---
chdir: /var/www/***
environment: production
address: 0.0.0.0
port: 3000
timeout: 30
log: log/thin.log
pid: tmp/pids/thin.pid
max_conns: 1024
max_persistent_conns: 512
require: []
wait: 30
servers: …Run Code Online (Sandbox Code Playgroud) 我无法配置瘦启动系统启动,我是Linux新手
我有CentOS 5.7
安装了薄的宝石,也安装了薄.
sudo gem install thin
sudo thin install
Run Code Online (Sandbox Code Playgroud)
当我尝试配置瘦启动系统启动时,我收到一个错误
sudo /sbin/chkconfig --level 345 thin on
error reading information on service thin: No such file or directory
Run Code Online (Sandbox Code Playgroud)
任何人都知道我为什么会收到这个错误?谢谢,
我有一个rails应用程序,它使用PDFKit来呈现pdf版本的网页.我使用Thin作为开发服务器.
问题是当我处于开发模式时.当我使用"bundle exec rails s"启动我的服务器并尝试渲染任何PDF时,整个过程都会陷入僵局,因为当您渲染PDF时,会向服务器请求一些额外的资源,如images和css,看起来有一个单独的线程.
如何配置rails开发服务器以运行多个工作线程?
非常感谢.