簡體   English   中英

無法在capistrano中部署多個主機

[英]cannot deploy multiple hosts in capistrano

我正在使用capistrano將Rails應用程序部署到大約20台服務器,當服務器數量〜10時工作正常,當將其增加到>〜10時,它不再工作

這是錯誤

cap aborted!
Errno::EPIPE: Broken pipe
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/server_version.rb:44:in `write'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/server_version.rb:44:in `negotiate!'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/server_version.rb:32:in `initialize'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:84:in `new'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh/transport/session.rb:84:in `initialize'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `new'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/net-ssh-3.2.0/lib/net/ssh.rb:232:in `start'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/connection_pool.rb:59:in `call'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/connection_pool.rb:59:in `with'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/netssh.rb:155:in `with_ssh'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/netssh.rb:49:in `upload!'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/capistrano-3.6.1/lib/capistrano/tasks/git.rake:24:in `block (3 levels) in <top (required)>'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/backends/abstract.rb:29:in `run'
/Users/khiem-nguyen/workspace/ruby/nenga-onepiece/cl-chef/deploy/vendor/bundle/ruby/2.3.0/gems/sshkit-1.11.2/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
The deploy has failed with an error: Broken pipe
** Invoke deploy:failed (first_time)
** Execute deploy:failed    


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:    


 DEBUG Uploading /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh 0.0%    

 DEBUG Uploading /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh 0.0%    

  INFO [7c256e12] Running /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh on onepiece-web07    

 DEBUG [7c256e12] Command: ( export RBENV_ROOT="$HOME/.rbenv/bin/rbenv" PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" ; /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh )    

  INFO Uploading /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh 100.0%    

  INFO Uploading /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh 100.0%    

  INFO [846397ba] Finished in 0.065 seconds with exit status 0 (successful).    

  INFO [3e8f8a49] Running /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh on onepiece-web03    

 DEBUG [3e8f8a49] Command: ( export RBENV_ROOT="$HOME/.rbenv/bin/rbenv" PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" ; /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh )    

  INFO [7c256e12] Finished in 0.037 seconds with exit status 0 (successful).    

  INFO [264aa0db] Running /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh on onepiece-web01    

 DEBUG [264aa0db] Command: ( export RBENV_ROOT="$HOME/.rbenv/bin/rbenv" PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" ; /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh )    

  INFO [a8720934] Finished in 0.265 seconds with exit status 0 (successful).    

  INFO [3e8f8a49] Finished in 0.043 seconds with exit status 0 (successful).    

  INFO [264aa0db] Finished in 0.038 seconds with exit status 0 (successful).    

 DEBUG Uploading /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh 0.0%    

  INFO Uploading /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh 100.0%    

  INFO [3d959fa8] Running /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh on onepiece-web02    

 DEBUG [3d959fa8] Command: ( export RBENV_ROOT="$HOME/.rbenv/bin/rbenv" PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH" ; /usr/bin/env chmod 700 /tmp/git-ssh-nenga-onepiece-production-khiem-nguyen.sh )    

  INFO [3d959fa8] Finished in 0.045 seconds with exit status 0 (successful).

我認為有一些與ssh max連接有關的信息???

上限版本:3.6.1 SSH套件:1.9.0

SSHKit(Capistrano中的SSH層)使用連接池。 這意味着它為每個主機維護一個SSH連接。 如果您在增加主機時看到管道斷開錯誤,那么我唯一想到的可能是防火牆或網關(即ssh代理)限制了同時連接的數量。

解決方法是,您可以嘗試禁用連接池。 將以下內容添加到您的deploy.rb

# Disable connection pool
SSHKit::Backend::Netssh.pool.idle_timeout = 0

這將使您的部署速度變慢,但可以解決連接錯誤。

您可以嘗試在Git服務器的服務器上的/ etc / ssh / sshd_config中調整MaxStartups。

默認值為10:30:60,前10個限制了此值。

MaxStartups指定與sshd守護程序的未認證並發連接的最大數量。 其他連接將被丟棄,直到身份驗證成功或該連接的LoginGraceTime過期為止。 預設值為10。

    Alternatively, random early drop can be enabled by specifying the
    three colon separated values "start:rate:full" (e.g.,
    "10:30:60").  sshd will refuse connection attempts with a proba-
    bility of "rate/100" (30%) if there are currently "start" (10)
    unauthenticated connections.  The probability increases linearly
    and all connection attempts are refused if the number of unau-
    thenticated connections reaches "full" (60).

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM