Apache フェイルオーバー BalanceMember

Apache フェイルオーバー BalanceMember

次の設定を実行すると、興味深い質問が頭の中に浮上しました(名前とIPは仮想です)。

背景:

route 1 - 10.10.10.10 is an IPSec tunnel
route 2 - 20.20.20.20 to the Internet
original service URL (nginx) - https://testscb.com - work
Virtual apache server (another machine, not mine) DNS - testscb.local.com

デフォルトルート1が利用できない場合は、すべてのトラフィックがルート2に移動していることを確認したいと思います。通信チャネルが復元されると、パス 1 に戻ります。

私の設定:

/etc/ホスト

10.10.10.10 testw1.com testscb1.com
20.20.20.20 testw2.com testscb2.com

ポート443が開いています。

traceroute to testscb1.com (10.10.10.10), 30 hops max, 60 byte packets
7  testscb1.com (10.10.10.10)  2.955 ms  2.985 ms  2.839 ms

traceroute to testscb2.com (20.20.20.20), 30 hops max, 60 byte packets
4  testscb2.com (20.20.20.20)  1.731 ms  1.834 ms  2.244 ms

/etc/httpd/virtual_host/testscb.conf

<VirtualHost *:80>
ServerName testscb.local.com

SSLProxyEngine on
SSLProxyVerify none 
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

ProxyHCExpr ok234 {%{REQUEST_STATUS} =~ /^[234]/}
#ProxyHCExpr gdown {%{REQUEST_STATUS} =~ /^[5]/}

#  BalanceMember in /etc/hosts
  <Proxy "balancer://testscb">
    BalancerMember https://testscb1.com hcmethod=HEAD hcexpr=ok234 hcinterval=20 hcuri=/test hcfails=4 hcpasses=4 
    BalancerMember https://testscb2.com hcmethod=HEAD hcexpr=ok234 hcinterval=20 hcuri=/test hcfails=4 hcpasses=4 status=+H
    ProxySet stickysession=JSESSIONID
    ProxySet lbmethod=heartbeat
  </Proxy>

    ProxyPass "/" "balancer://testscb/"
    ProxyPassReverse "/" "balancer://testscb/"

<Location "/">
    ProxyPass "https://testscb.com/"
    ProxyPassReverse "https://testscb.com/"
    AllowOverride None
    Order Deny,Allow
    Deny from All
    Allow from All
</Location>

LogLevel debug
ErrorLog /var/log/httpd/testscb-error_log
CustomLog /var/log/httpd/testscb-access_log combined
</VirtualHost>

Apacheエレガント

httpd.serviceアクティブ:アクティブ(実行中)

テスト: 私はApacheサーバーでカールを使用します。

カール-vkhttps://testscb1.com/

* Mark bundle as not supporting multiuse
< 
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host testscb1.com left intact

カール-vkhttps://testscb2.com/

* Mark bundle as not supporting multiuse
< 
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host testscb2.com left intact

カールを使用する tcpdump は、交換が進行中であることを確認します。

マイコンピュータからカールを介してリクエストを送信します。

カール-vkhttp://testscb.local.com/

* Mark bundle as not supporting multiuse
< 
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host testscb.local.com left intact

しかし、パス2が使用されていることがわかりました。バックアップとして使用する必要があります(tcpdumpを参照)。

さらに興味深いです。通信リンク障害をテストするために、パスを逆に変更しています。

ip ro add 20.20.20.20 via 127.0.0.1

今カール -v -khttps://testscb2.com/「ポート443:接続タイムアウト」エラーが発生します。

マイコンピュータからリクエストを送信するときのcurl -v -khttp://testscb.local.com/

また、「ポート443:接続がタイムアウトしました」というメッセージが表示されます。

ルート2がなぜ含まれているのかわかりません。 Apacheにはルート1が存在しないようです。

あなたのアドバイスに非常に感謝します。ありがとうございます。

ベストアンサー1

おすすめ記事