In a joyful way

ゆるーっと。ふわーっと。楽しくいきましょ。

Traffic ManagerにExternal Endpointを追加してみた

leave a comment »

さて、GoAzureの現実逃避を兼ねて、
直前で、Traffic ManagerにExternal Endpointが追加したい件というのを
2、3年ぶりにBlog postしていて、その後触れていなかったので、備忘録も兼ねて、検証結果をpostしときます。

前回も記載していますが、基本的にやったことと言えば、
Azure Traffic Manager External Endpoints and Weighted Round Robin via PowerShellにある手順通りに
PowerShellでぽちぽちっとコマンドを叩いただけです。
※ 2015/3/22現在、Azure Traffic Managerに外部エンドポイントを追加/編集できるのは、PowerShellのみです。
ポータル上(Previewポータルからは使えない)からは、削除のみ可能です。

Azure PowerShellのInstall方法とか、AzureのCmdlet一覧が知りたい!とか、
サブスクリプションを大量に持ってて、(課金の関係上)今日はこのサブスクリプションしたい!とか、
Azure Officalやら田口さんBlogに載っているので、そちらをご参照あれ!

あとは、手順通りに以下のコマンドを実行していきました。

  1. TrafficManager上で作成してあるProfile一覧(要は設定一覧)を取得します。
    ここでは何にも作ってなければ、Tableも何も出ないで終わります。

    ---
    PS C:\> $profiles = Get-AzureTrafficManagerProfile PS C:\> $profiles | Format-Table
    ---
  2. 続いてProfileを新規作成します。
    Subscription内で重複していなければ使えるので、チュートリアル通りの名前でもお好きなのをつけてもらえればと。
    今回は「sample20150322-profile」という何の捻りもないプロファイル名にします。
    ちなみにプロファイルはポータルからぽちぽちっと作れるので、PowerShellが苦手だったらそっちでもOKです。
    下記のPowerShellで設定した内容もポータル上の[構成]から変更可能となっています。

    ---
    PS C:\> New-AzureTrafficManagerProfile -Name "sample20150322-profile" -DomainName "sample201
    50322.trafficmanager.net" -LoadBalancingMethod "RoundRobin" -Ttl 30 -MonitorProtocol "Http" 
    -MonitorPort 80 -MonitorRelativePath "/"
    
    TimeToLiveInSeconds : 30
    MonitorRelativePath : /
    MonitorPort : 80
    MonitorProtocol : Http
    LoadBalancingMethod : RoundRobin
    Endpoints : {}
    MonitorStatus : Inactive
    Name : sample20150322-profile
    DomainName : sample20150322.trafficmanager.net
    Status : Enabled
    ---
  3. Profileを作成すると、登録されているエンドポイントが1つもないので「非アクティブ」状態で作成されます。
    外部エンドポイントだけでもよいのですが、せっかくなのでWebSitesを追加してみます。(面倒なのでGUIからぽちっと
    ちなみにWebSitesはTrafficManagerに登録できるのは、Standard以上になるので要注意。
    Featured image
  4. プロファイルを確認して、いよいよ外部エンドポイントの登録!
    ---
    PS C:\> $profile = Get-AzureTrafficManagerProfile -Name "sample20150322-profile"
    PS C:\> $profile | Format-Table
    
    TimeToLiveI MonitorRela MonitorPort MonitorProt LoadBalanci Endpoints MonitorStat Name DomainName Status
     nSeconds tivePath ocol ngMethod us
    ----------- ----------- ----------- ----------- ----------- --------- ----------- ---- ---------- ------
     30 / 80 Http RoundRobin {sample-... Online sample20... sample20... Enabled
    
    PS C:\> Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "www.mic
    rosoft.com" -Status "Enabled" -Type "Any" -Location "North Europe" | Set-AzureTrafficManager
    Profile
    
    TimeToLiveInSeconds : 30
    MonitorRelativePath : /
    MonitorPort : 80
    MonitorProtocol : Http
    LoadBalancingMethod : RoundRobin
    Endpoints : {sample-20150111.azurewebsites.net, www.microsoft.com}
    MonitorStatus : Online
    Name : sample20150322-profile
    DomainName : sample20150322.trafficmanager.net
    Status : Enabled
    ---

    とくに何のエラーもなく、サクッと登録できます。しめしめ。
    無邪気にYahoo!さんとGoogleさんも登録してみました。

    ---
    PS C:\> Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "www.yah
    oo.co.jp" -Status "Enabled" -Type "Any" -Location "Japan East" | Set-AzureTrafficManagerProf
    ile
    
    TimeToLiveInSeconds : 30
    MonitorRelativePath : /
    MonitorPort : 80
    MonitorProtocol : Http
    LoadBalancingMethod : RoundRobin
    Endpoints : {sample-20150111.azurewebsites.net, www.microsoft.com, www.yahoo.co.jp}
    MonitorStatus : Degraded
    Name : sample20150322-profile
    DomainName : sample20150322.trafficmanager.net
    Status : Enabled
    
    PS C:\> Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "www.goo
    gle.co.jp" -Status "Enabled"
     -Type "Any" -Location "Japan East" | Set-AzureTrafficManagerProfile
    
    TimeToLiveInSeconds : 30
    MonitorRelativePath : /
    MonitorPort : 80
    MonitorProtocol : Http
    LoadBalancingMethod : RoundRobin
    Endpoints : {sample-20150111.azurewebsites.net, www.microsoft.com, www.yahoo.co.jp, www.goog
    le.co.jp}
    MonitorStatus : Degraded
    Name : sample20150322-profile
    DomainName : sample20150322.trafficmanager.net
    Status : Enabled
    ---
  5. 登録されている内容をポータルで確認してみます。
    MSさんのチュートルアル通りに登録しているのに、MSサイトだけ「低下(Degraded)」状態です。
    非常に残念な気持ちに…
    Featured image
  6. 残念な気持ちを抑えつつ、”Azure TrafficManager Degraded”という直球でググったところ、
    トラシュー方法が公式に。
    Troubleshooting Scenario 4 – Windows Azure Traffic Manager Degraded Status
    これによると、
    “A 30x redirect (or any other non-200 response) will fail, even if the redirected URL returns a 200.”
    だそうで。これでしょ。絶対原因これでしょ。と。
  7. せっかくなので、サイトにあるようにwgetコマンドで内容を確認してみます。
    見た目には”200 OK”で返ってきているものの、
    Featured image
    取得したページを確認すると、結局リダイレクトされるという(まー、ブラウザで見てもその挙動だし)Featured image
    …これが原因で登録した外部エンドポイントは低下(Degraded)となるのでした。

★おまけ
これを回避しようと思って、リダイレクト先のパスを外部エンドポイントとして登録しようとしたところ、
「お前が登録したドメイン名は不正だZE★」と言われて登録できませんでした。
ルートじゃないと弾くのが仕様のようです。

---
PS C:\> Add-AzureTrafficManagerEndpoint -TrafficManagerProfile $profile -DomainName "www.microso
ft.com/en-us" -Status "Enabled" -Type "Any" -Location "North Central US" | Set-AzureTrafficManag
erProfile

Set-AzureTrafficManagerProfile : BadRequest: The domain name www.microsoft.com/en-us is invalid.発生場所 行:1 文字:164
+ ... Central US" | Set-AzureTrafficManagerProfile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Set-AzureTrafficManagerProfile]、CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.TrafficManager.Profile.SetAzureTrafficManagerProfile
---

基本的には簡単に使えるTraffic Manager様なので、
ちょっと癖はありますが用途にあわせてご利用くださいませ〜!

Written by Saori Ando

2015/03/22 @ 19:15

カテゴリー: Azure

Tagged with

コメントを残す