配置Azure內部負載均衡ILB for PaaS示例

配置需求:配置Azure內部負載均衡ILB

應用場景:主要用於內部應用系統,既想用PaaS的靈活性,又不想外部訪問(即走外部域名,cloud service VIP提供LB),要求多臺webrole提供同一服務做LB.

配置要求:Azure SDK 2.4以上, 建議自定義虛擬網絡

配置示例:

1.定義cscfg文件

<?xmlversion="1.0" encoding="utf-8"?>

<ServiceConfigurationserviceName="AzureCloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"osFamily="4" osVersion="*" schemaVersion="2014-06.2.4">

 <Role name="MyILBWebRole">

   <Instances count="2" />

 </Role>

 <NetworkConfiguration>

   <VirtualNetworkSite name="myvnet01" />

   <AddressAssignments>

     <InstanceAddress roleName="MyILBWebRole">

       <Subnets>

         <Subnet name="subnet01" />

       </Subnets>

     </InstanceAddress>

   </AddressAssignments>

   <LoadBalancers>

     <LoadBalancer name="myILBtest"><--定義ILB名稱-->

       <FrontendIPConfiguration type="private" subnet="subnet01"staticVirtualNetworkIPAddress="192.168.1.10" /> <!-- 指定ILB使用靜態IP-->

     </LoadBalancer>

   </LoadBalancers>

 </NetworkConfiguration>

</ServiceConfiguration>

2.定義csdef文件

<?xmlversion="1.0" encoding="utf-8"?>

<ServiceDefinitionname="AzureCloudService1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"schemaVersion="2014-06.2.4">

 <WebRole name="MyILBWebRole" vmsize="Small">

   <Sites>

     <Site name="Web">

       <Bindings>

         <Binding name="Endpoint1" endpointName="Endpoint1" />

       </Bindings>

     </Site>

   </Sites>

   <Endpoints>

     <InputEndpoint name="Endpoint1" protocol="http" port="80"localPort="80" loadBalancer="myILBtest"  />  <!-- 對webrole指定使用的ILB-->

    </Endpoints>

 </WebRole>

</ServiceDefinition>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章