配置需求:配置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>