热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

azure虚拟机部署iis

In one of my articles about Microsoft Azure, I show how to create credentials and how to connect to an Azure Database using SQL Server Management Studio (SSMS). In this new article, we will talk about the Azure Virtual Machines and we will learn how to connect to them using our local SSMS. You will require unblocking ports, add endpoints and other tasks that I will explain later. We will also learn how to export a local database to an Azure Virtual Machine with SQL Server installed.

在我的有关Microsoft Azure的文章中 ,我展示了如何创建凭据以及如何使用SQL Server Management Studio(SSMS)连接到Azure数据库。 在这篇新文章中,我们将讨论Azure虚拟机,并将学习如何使用本地SSMS连接到它们。 您将需要取消阻塞端口,添加端点和其他任务,我将在后面解释。 我们还将学习如何将本地数据库导出到安装了SQL Server的Azure虚拟机。

要求 ( Requirements )

In this example, we will require an Azure Virtual Machine installed, a local machine with SQL Server and SSMS installed, the Cloud Adapter (we are including the steps to configure it) and a certificate which will also be explained in this section.

在此示例中,我们将需要安装Azure虚拟机,安装了SQL Server和SSMS的本地计算机,云适配器(我们包括配置它的步骤)和证书,本节还将对此进行说明。

  1. You will require an Azure Virtual Machine with SQL Server installed. To create an Azure Account, review this link. To create a virtual machine, review this link.

    您将需要安装了SQL Server的Azure虚拟机。 要创建一个Azure帐户,请查看此链接 。 要创建虚拟机,请查看此链接 。
  2. A local machine with the SQL Server Engine Installed and a database to export with access to internet.

    The Cloud Adapter

    1. A Cloud Adapter. The cloud adapter is an Azure Service required for SQL Server and generates a SSL certificate In the Azure portal. In order to create it, go to Virtual Machines and click on the virtual machine name.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      Figure r1. The Azure virtual machines.
    2. Click on EndPoints.


      Figure r2. The Endpoints

    3. Press the New icon.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      Figure r3. Add new endpoints
    4. Add the Endpoint name, protocol and port (by default it is the port 11435).


      Figure r4. The cloud Adapter for SQL

    A certificate

    Another requirement is a certificate to connect to the Cloud. In order to do it do the following steps:

    1. Open the certmgr.msc. You can create your certificate or use an existing one. In this example we will use an existing one.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R5. The certificate console
    2. Select the certificate right click and select All Tasks>Export


      R6. Export a certificate
    3. The wizard to export certificates will be displayed. Click next.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R7. Export Wizard.
    4. Select if you want to have a private key.


      R8. Private key question

    5. Specify the format of the certificate.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R9. Select the certify format
    6. Specify a name and a path.


      R10. Selecting name and path of the .cer file.

    7. Once the Wizard is completed, press finish.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R11. Final step of the export wizard.
    8. Go to the Azure portal and click on the Virtual Machine.


      R12. The virtual machine.

    9. Click on the Management Certificates link.

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机
      R13. The certificates

    10. Click the Upload button and upload the certificate created on step 7.


      R14. The option to upload certificates.

    11. Getting Started

      1. To connect to a Virtual Machine, you can use the SQL Server Account. In order to enable the SQL Server authentication, in the Azure Virtual Machine (VM), open the SSMS and connect to the database. Right click on your Server and select properties. Change the Server Authentication to SQL Server and Windows Authentication to connect from your local machine.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机
        Figure 1. Server properties

      2. You will be prompted a message about restarting the SQL Server Service.


        Figure 2. Information message.

      3. Restart the Service in order for the new configuration to take effect.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 3. Restarting the MSSQL Service
      4. Now that the SQL Server authentication is enabled, create a SQL Server Login.


        Figure 4. Creating a new login.

      5. Specify the login name and passwords. It is recommended to enforce the password policy for security reasons. In this example, we will omit the Enforce password policy to simplify the example.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 5. Login settings
      6. Go to the Virtual Machine in the Azure Portal and click on the Virtual Machine name.


        Figure 6. The virtual machine status

      7. Click the ENDPOINTS link and press the Add icon to add a new Endpoint.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机
        Figure 7. Endpoints

      8. Select the add Standalone Endpoint


        Figure 8. Adding endpoint

      9. Write the name of the Endpoint. The protocol should be TCP and the port by default in the default instance is 1433.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 9. Endpoint settings
      10. The ACL allows you to specify the range of subnets allowed to access to your Azure virtual Machine. You can provide the name and subnet. If you do not your Internet IP, you can use this link.


        Figure 10. The ACL details

      11. You also need to enable the ports used to access remotely. Go to the Windows Firewall and right click on the Inbound Rules and select new rule.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 11. The Inbound rules.
      12. Specify the port to which you want to apply a rule. In this case, it is the port 1433.


        Figure 12. The TCP IP SQL Server port

      13. In the action, select the allow the connection option.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 13. Allow permissions

      14. Select the rule that you want to apply.


        Figure 14. Rules to apply

      15. Write a name for the rule.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 15. Rule name

      16. Now connect to your Azure VM from the SSMS of the local machine.

        Figure 16. Connect to an Azure VM from the local SSMS

        If everything is OK you can now connect to the SQL Server machine with Azure from your local machine.

      How to deploy your database using the Deploy Database to Windows Azure VM

      Now we will export our local database to the Azure Vm.

      1. In the local SSMS, Select the database that you want to copy and select Tasks>Deploy Database to Windows Azure.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 17. The Deploy Database to Azure VM Wizard.
      2. The Introduction Wizard Windows will be displayed.


        Figure 18. The Introduction Wizard.

      3. Press the Connect button to connect to the local SQL Server.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 19. The local machine information

      4. Specify the Server name and credentials and press Connect.


        Figure 20. The local machine credentials.

      5. Select a database to export and a temporary location for the backup files. Make sure that the SQL Server has permissions on a temporary location.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 21. The Database to export and the temporary file.
      6. To connect to Azure, you will need a Certificate. You can also work with a publishing profile. For more information about a publishing profile.


        Figure 22. Certificate.

      7. Press the Select button and select the certificate created on the requirements section of this article. Copy the subscription ID of step 9 of the requirements in the certificate section.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 23. The subscription ID.

      8. Specify the Cloud Service name, Virtual Machine name and Storage Account and then press Settings.


        Figure 24. The subscription ID.

      9. Specify the Virtual Machine, your credentials and the Cloud Adapter port. Verify in the requirements the port used. By default, it is the port 11435.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 25. Cloud Adapter information.
      10. You will receive a message about the certificate. If you agree, press Trust Publisher and connect.


        Figure 26. The Trust message.

      11. Finally you will have your information like this:

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 27. The Azure VM information and the Local SQL Server information
      12. If everything is OK, the summary window will be displayed.


        Figure 28. Summary Window

      13. Finally, you will receive the results windows that will be green if everything is OK.

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        Figure 29. The Results wizard.
      14. To verify that the database was copied successfully, go to the virtual machine and verify that the database was copied successfully.

      Conclusion

      In this tutorial, we’ve learned how to connect to an Azure virtual machine with SQL Server using our local SQL Server. We also learned how to export a local database to a SQL Server Azure VM.

    安装了SQL Server引擎的本地计算机和要访问Internet的要导出的数据库。

    云适配器

    1. 云适配器。 云适配器是SQL Server必需的Azure服务,并在Azure门户中生成SSL证书。 为了创建它,请去虚拟机并且点击虚拟机名称。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      图r1。 Azure虚拟机。
    2. 单击端点。


      图r2。 终点

    3. 按“新建”图标。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      图r3。 添加新端点
    4. 添加端点名称,协议和端口(默认情况下为端口11435)。


      图r4。 适用于SQL的云适配器

    证书

    另一个要求是连接到云的证书。 为此,请执行以下步骤:

    1. 打开certmgr.msc。 您可以创建证书或使用现有证书 。 在此示例中,我们将使用现有示例。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R5。 证书控制台
    2. 右键单击证书,然后选择“所有任务”>“导出”


      R6。 导出证书
    3. 将显示导出证书的向导。 点击下一步。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R7。 导出向导。
    4. 选择是否要使用私钥。


      R8。 私人 关键 问题

    5. 指定证书的格式。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R9。 选择认证格式
    6. 指定名称和路径。


      R10。 选择名称和路径 cer 文件。

    7. 向导完成后,按完成。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

      R11。 导出向导的最后一步。
    8. 转到Azure门户,然后单击“虚拟机”。


      R12。 虚拟机。

    9. 单击管理证书链接。

      azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机
      R13。 证书

    10. 单击上载按钮,然后上载在步骤7中创建的证书。


      R14。 上传证书的选项。

    11. 入门

      1. 要连接到虚拟机,您可以使用SQL Server帐户。 为了启用SQL Server身份验证,请在Azure虚拟机(VM)中,打开SSMS并连接到数据库。 右键单击服务器,然后选择属性。 将服务器身份验证更改为SQL Server和Windows身份验证以从本地计算机连接。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机
        图1. 服务器属性

      2. 系统将提示您有关重新启动SQL Server服务的消息。


        图2. 信息消息。

      3. 重新启动服务,以使新配置生效。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图3.重新启动MSSQL服务
      4. 现在已启用SQL Server身份验证,请创建一个SQL Server登录名。


        图4.创建一个新的登录名。

      5. 指定登录名和密码。 出于安全原因,建议强制执行密码策略。 在此示例中,我们将省略“强制密码”策略以简化示例。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图5.登录设置
      6. 转到Azure门户中的虚拟机,然后单击虚拟机名称。


        图6.虚拟机状态

      7. 单击ENDPOINTS链接,然后按添加图标以添加新的端点。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机
        图7.端点

      8. 选择添加独立端点


        图8. 添加端点

      9. 输入端点的名称。 该协议应为TCP,默认实例中的默认端口为1433。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图9.端点设置
      10. ACL允许您指定允许访问Azure虚拟机的子网范围。 您可以提供名称和子网。 如果您没有Internet IP,则可以使用此链接 。


        图10. ACL详细信息

      11. 您还需要启用用于远程访问的端口。 转到Windows防火墙,然后右键单击“入站规则”,然后选择新规则。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图11.入站规则。
      12. 指定要对其应用规则的端口。 在这种情况下,它是端口1433。


        图12. TCP IP SQL Server端口

      13. 在操作中,选择“允许连接”选项。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图13. 允许权限

      14. 选择您要应用的规则。


        图14. 适用规则

      15. 为规则写一个名字。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图15.规则名称

      16. 现在,从本地计算机的SSMS连接到您的Azure VM。

        图16. 从本地SSMS连接到Azure VM

        如果一切正常,您现在可以从本地计算机使用Azure连接到SQL Server计算机。

      如何使用将数据库部署到Windows Azure VM来部署数据库

      现在,我们将本地数据库导出到Azure Vm。

      1. 在本地SSMS中,选择要复制的数据库,然后选择“任务”>“将数据库部署到Windows Azure”。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图17.将数据库部署到Azure VM向导。
      2. 将显示“简介向导”窗口。


        图18.简介向导。

      3. 按“连接”按钮连接到本地SQL Server。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图19. 本地机器信息

      4. 指定服务器名称和凭据,然后按连接。


        图20.本地计算机凭据。

      5. 选择要导出的数据库和备份文件的临时位置。 确保SQL Server对临时位置具有权限。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图21.要导出的数据库和临时文件。
      6. 若要连接到Azure,您将需要一个证书。 您也可以使用发布配置文件。 有关发布配置文件的更多信息。


        图22 证书。

      7. 按“选择”按钮,然后选择在本文的“需求”部分上创建的证书。 在证书部分中复制需求的步骤9的订阅ID。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图23.订阅ID。

      8. 指定云服务名称,虚拟机名称和存储帐户,然后按设置。


        图2 4 订阅ID。

      9. 指定虚拟机,您的凭据和云适配器端口。 在要求中验证使用的端口。 默认情况下,它是端口11435。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图25.云适配器信息。
      10. 您将收到有关证书的消息。 如果您同意,请按Trust Publisher并进行连接。


        图26.信任消息。

      11. 最后,您将获得如下信息:

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图27. Azure VM信息和本地SQL Server信息
      12. 如果一切正常,将显示“摘要”窗口。


        图28.摘要窗口

      13. 最后,如果一切正常,您将收到绿色的结果窗口。

        azure虚拟机部署iis_如何将数据库迁移到Azure虚拟机

        图29.结果向导。
      14. 要验证数据库是否已成功复制,请转到虚拟机并验证数据库是否已成功复制。

      结论

      在本教程中,我们学习了如何使用本地SQL Server通过SQL Server连接到Azure虚拟机。 我们还学习了如何将本地数据库导出到SQL Server Azure VM。

翻译自: https://www.sqlshack.com/migrate-your-database-to-an-azure-virtual-machine/

azure虚拟机部署iis


推荐阅读
  • 本文详细探讨了JDBC(Java数据库连接)的内部机制,重点分析其作为服务提供者接口(SPI)框架的应用。通过类图和代码示例,展示了JDBC如何注册驱动程序、建立数据库连接以及执行SQL查询的过程。 ... [详细]
  • MySQL 数据库迁移指南:从本地到远程及磁盘间迁移
    本文详细介绍了如何在不同场景下进行 MySQL 数据库的迁移,包括从一个硬盘迁移到另一个硬盘、从一台计算机迁移到另一台计算机,以及解决迁移过程中可能遇到的问题。 ... [详细]
  • 本文详细介绍了如何在Linux系统上安装和配置Smokeping,以实现对网络链路质量的实时监控。通过详细的步骤和必要的依赖包安装,确保用户能够顺利完成部署并优化其网络性能监控。 ... [详细]
  • 通过Web界面管理Linux日志的解决方案
    本指南介绍了一种利用rsyslog、MariaDB和LogAnalyzer搭建集中式日志管理平台的方法,使用户可以通过Web界面查看和分析Linux系统的日志记录。此方案不仅适用于服务器环境,还提供了详细的步骤来确保系统的稳定性和安全性。 ... [详细]
  • 阿里云ecs怎么配置php环境,阿里云ecs配置选择 ... [详细]
  • Windows服务与数据库交互问题解析
    本文探讨了在Windows 10(64位)环境下开发的Windows服务,旨在定期向本地MS SQL Server (v.11)插入记录。尽管服务已成功安装并运行,但记录并未正确插入。我们将详细分析可能的原因及解决方案。 ... [详细]
  • 本文详细介绍如何使用Python进行配置文件的读写操作,涵盖常见的配置文件格式(如INI、JSON、TOML和YAML),并提供具体的代码示例。 ... [详细]
  • 本文介绍了一款用于自动化部署 Linux 服务的 Bash 脚本。该脚本不仅涵盖了基本的文件复制和目录创建,还处理了系统服务的配置和启动,确保在多种 Linux 发行版上都能顺利运行。 ... [详细]
  • DNN Community 和 Professional 版本的主要差异
    本文详细解析了 DotNetNuke (DNN) 的两种主要版本:Community 和 Professional。通过对比两者的功能和附加组件,帮助用户选择最适合其需求的版本。 ... [详细]
  • MongoDB集群配置:副本集与分片详解
    本文详细介绍了如何在MongoDB中配置副本集(Replica Sets)和分片(Sharding),并提供了具体的步骤和命令,帮助读者理解并实现高可用性和水平扩展的MongoDB集群。 ... [详细]
  • 本文探讨了MariaDB在当前数据库市场中的地位和挑战,分析其可能面临的困境,并提出了对未来发展的几点看法。 ... [详细]
  • 探讨如何从数据库中按分组获取最大N条记录的方法,并分享新年祝福。本文提供多种解决方案,适用于不同数据库系统,如MySQL、Oracle等。 ... [详细]
  • 本文详细介绍如何利用已搭建的LAMP(Linux、Apache、MySQL、PHP)环境,快速创建一个基于WordPress的内容管理系统(CMS)。WordPress是一款流行的开源博客平台,适用于个人或小型团队使用。 ... [详细]
  • 方法:1 配置数据库basediros.path.abspath(os.path.dirname(__file__))  #获取当前文件的绝对路径appFlask(__name__ ... [详细]
  • 本文针对Windows 7环境下使用IIS 7.5和.NET Framework 4.0时遇到的ASP.NET设置不适用于集成托管管道模式的问题,提供了一个有效的解决方案。通过调整web.config文件中的特定配置,可以轻松解决此问题。 ... [详细]
author-avatar
mmmmGi_626
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有