首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用不同域名的单一蔚蓝云服务上的多台虚拟机?

使用不同域名的单一蔚蓝云服务上的多台虚拟机?
EN

Server Fault用户
提问于 2016-05-23 21:54:07
回答 1查看 178关注 0票数 0

假设我必须在azure上部署200多台虚拟机。每个vm都有一个网站,每个vm都必须有唯一的域/ip地址。

我可以将每个vm部署到单独的cloude服务(并且有不同的ip),但是每次订阅的cloude服务的限制是200,因此我只能使用200个vm(网站)。

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

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

  1. 如何在单一云服务中为多台虚拟机拥有不同的域/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. 这可以通过新的资源管理器模型来实现吗?

用于将多个vm部署到单个云服务的代码:

代码语言:javascript
复制
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);

        }
    }
EN

回答 1

Server Fault用户

发布于 2016-05-24 08:06:59

如果希望每个VM在云服务中拥有自己的IP,那么需要查看实例级公共IP,它们是分配给每个VM的单独IP,而不是云服务。

但是,我建议您也考虑完全放弃使用云服务,转而使用新的基于资源管理器的堆栈。如果您不知道Azure的所有V2资源都离开了云服务模型,而是使用新的资源管理器格式。这种新格式对于您所做的工作有一些重要的优点:

  • 破坏我们的网络接口并将平衡器加载到可以有单独的公共和私有IP的单独项目中
  • 基于声明模板的资源创建
  • 并行创建资源,特别重要的是,如果您需要同时创建大量VM

云服务仍然存在,而且还没有宣布要删除它们,但是ARM模型似乎更适合您所要做的事情。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/778571

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档