单一azure云服务上的多个虚拟机具有不同的域名?

假设我必须在Azure上部署超过200台虚拟机。 每个虚拟主机都有一个网站,每个虚拟主机都必须有唯一的域名/ IP地址。

我可以部署每个vm来分离cloude服务(并且有不同的ip),但是每个订阅的cloude服务的限制是200,所以这样我就限制在200个vm(web站点)。

但是如果我在一个cloude服务中部署多个虚拟机(每个云服务的限制是50个虚拟机),该怎么办? 我这样,我可以有每个订阅50云vu的服务* 200云服务!

问题是vm必须有不同的域/ ip,当我将多个vm部署到一个cloude服务时,所有vm都具有相同的域和ip。

  1. 如何在单一的cloude服务有不同的域/ ip的多个虚拟机?

  2. 这可以通过每个云服务的多个VIP来实现吗? https://azure.microsoft.com/en-us/documentation/articles/load-balancer-multivip/

  3. 这可以通过保留的IP地址来实现吗? https://azure.microsoft.com/en-us/blog/reserved-ip-addresses/

  4. 新的资源pipe理器模型可以实现吗?

我可以用来将多个虚拟机部署到单个云服务的代码:

private async Task CreateVirtualMachine() { DeploymentGetResponse deploymentResponse = await _computeManagementClient.Deployments.GetBySlotAsync("myservicename", DeploymentSlot.Production); if (deploymentResponse == null) { var parameters = new VirtualMachineCreateDeploymentParameters { DeploymentSlot = DeploymentSlot.Production, Name = "mservicename", Label = "myservicename" }; parameters.Roles.Add(new Role { OSVirtualHardDisk = new OSVirtualHardDisk { HostCaching = VirtualHardDiskHostCaching.ReadWrite, SourceImageName = "imagename" }, RoleName = "vmname", RoleType = VirtualMachineRoleType.PersistentVMRole.ToString(), RoleSize = VirtualMachineRoleSize.Small, ProvisionGuestAgent = true }); parameters.Roles[0].ConfigurationSets.Add(new ConfigurationSet { ComputerName = "vmname", ConfigurationSetType = ConfigurationSetTypes.LinuxProvisioningConfiguration, HostName = "vmname", AdminUserName = "adminusername", AdminPassword = "adminpass", UserName = "username", UserPassword = "userpass", DisableSshPasswordAuthentication = false, }); parameters.Roles[0].ConfigurationSets.Add(new ConfigurationSet { ConfigurationSetType = ConfigurationSetTypes.NetworkConfiguration, InputEndpoints = new List<InputEndpoint>() { new InputEndpoint() { Name = "HTTP", Protocol = InputEndpointTransportProtocol.Tcp, LocalPort = 80, Port = 80 } } }); var response = await _computeManagementClient.VirtualMachines.CreateDeploymentAsync("mservicename", parameters); } else { var createParameters = new VirtualMachineCreateParameters { OSVirtualHardDisk = new OSVirtualHardDisk { HostCaching = VirtualHardDiskHostCaching.ReadWrite, SourceImageName = "imagename" }, RoleName = "vmname", RoleSize = VirtualMachineRoleSize.Small, ProvisionGuestAgent = true, ConfigurationSets = new List<ConfigurationSet> { new ConfigurationSet { ComputerName = "vmname", ConfigurationSetType = ConfigurationSetTypes.LinuxProvisioningConfiguration, HostName = "vmname", AdminUserName = "adminusername", AdminPassword = "adminpass", UserName = "username", UserPassword = "userpass", DisableSshPasswordAuthentication = false }, new ConfigurationSet { ConfigurationSetType = ConfigurationSetTypes.NetworkConfiguration, InputEndpoints = new List<InputEndpoint>() { new InputEndpoint() { Name = "HTTP", Protocol = InputEndpointTransportProtocol.Tcp, LocalPort = 81, Port = 81 } } } } }; var responseCreate = await _computeManagementClient.VirtualMachines.CreateAsync("mservicename", deploymentResponse.Name, createParameters); } } 

如果您希望每个虚拟机在云服务中拥有自己的IP,那么您需要查看实例级别公有IP ,这些IP是分配给每个虚拟机的,而不是云服务。

不过,我build议你也考虑从完全使用云服务转向使用新的基于资源pipe理器的堆栈 。 如果您不知道Azure的所有V2资源都将从云服务模型中移除,而是使用新的资源pipe理器格式。 这种新格式对于你正在做的事情有一些显着的优点:

  • 将我们的networking接口和负载平衡器分解成可以具有单独的公共和私有IP的单独项目
  • 基于声明模板的资源创build
  • 并行创build资源,如果您需要一次创build大量虚拟机,这一点尤其重要

云服务仍然存在,并没有宣布他们的移除,但ARM模型似乎更适合你正在做的事情。