タグ

ansibleとautoに関するmytechnoteのブックマーク (1)

  • SSHの多重接続について

    tl;dr デプロイツールによっては 同じサーバに SSH で何回もコマンドを実行することがある(ansible とか)。 コマンドごとに毎回コネクション(トンネル)を確立するとオーバーヘッドも大きくなる。 OpenSSH は $HOME/.ssh/config に次の設定を書くことで、接続を多重化(multiplex)することができる。 # $HOME/.ssh/config Host machine1 HostName machine1.example.org ControlPath ~/.ssh/controlmasters/%r@%h:%p ControlMaster auto ControlPersist 1h multiplex 前後の速度差 SSH を使ってリモートサーバで echo コマンドを実行した時の速度差を計測 before multiplex $ time ssh

    SSHの多重接続について
  • 1