我需要你的帮助!
我已经使用 Nginx、MySQL、Solr 和 Unicorn 在 Ubuntu 12.04 中部署了我的 Rails 应用程序。
每个提到的服务都被启动,而不是独角兽,它说如下:
I, [2013-02-11T16:10:20.187989 #27547] INFO -- : 刷新宝石列表 I, [2013-02-11T16:10:52.159198 #27547] INFO -- : 取消链接现有套接字=/var/www/ staging/shared/unicorn.sock I, [2013-02-11T16:10:52.159488 #27547] INFO -- : 监听 addr=/var/www/staging/shared/unicorn.sock fd=12 E, [2013- 02-11T16:10:52.161513 #27547] 错误 -- : 无法分配内存 - fork(2) (Errno::ENOMEM) /var/www/staging/shared/gems/ruby/1.9.1/gems/unicorn-4.5 .0/lib/unicorn/http_server.rb:496:in
fork' /var/www/staging/shared/gems/ruby/1.9.1/gems/unicorn-4.5.0/lib/unicorn/http_server.rb:496:in
spawn_missing_workers' /var/www/staging/shared/gems/ruby/1.9.1/gems/unicorn-4.5.0/lib/unicorn/http_server.rb:142 :instart' /var/www/staging/shared/gems/ruby/1.9.1/gems/unicorn-4.5.0/bin/unicorn_rails:209:in
' /var/www/staging/shared/gems/ruby/1.9.1/bin/unicorn_rails:23:inload' /var/www/staging/shared/gems/ruby/1.9.1/bin/unicorn_rails:23:in
'
VDS 有 1.5Gb 的 RAM,对于独角兽来说已经足够了:
cat /proc/meminfo
MemTotal: 1585152 kB MemFree: 989580 kB Cached: 425296 kB Active: 348504 kB Inactive: 175356 kB Active(anon): 98488 kB Inactive(anon): 76 kB Active(file): 250016 kB Inactive(file): 175280 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 204800 kB SwapFree: 204800 kB Dirty: 12 kB Writeback: 0 kB AnonPages: 98564 kB Shmem: 3604 kB Slab: 71680 kB SReclaimable: 66144 kB SUnreclaim: 5536 kB
我有 unicorn_rails v4.5.0
Unicorn 通过以下命令启动:
bundle exec unicorn_rails -c /var/www/staging/current/config/unicorn.rb -E production -D
我在这里做错了什么?
嗯,我记得,以前我有以下奇怪的错误:
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.3-p327' -c 'cd /var/www/staging/current && bundle exec unicorn_rails -c /var/www/staging/current/config/unicorn.rb -E production -D'"
也许它与记忆问题有某种关系......</p>