將內部部署 Linux 應用程式重新裝載至 Azure Vm 和適用於 MySQL 的 Azure 資料庫Rehost an on-premises Linux application to Azure VMs and Azure Database for MySQL

本文說明虛構公司 Contoso 如何如何兩層式 燈泡 應用程式,並使用 Azure 虛擬機器 (vm) 和適用於 MySQL 的 Azure 資料庫,將其從內部部署遷移至 azure。This article shows how the fictional company Contoso rehosts a two-tier LAMP-based application and migrates it from on-premises to Azure by using Azure Virtual Machines (VMs) and Azure Database for MySQL.

此範例中使用的服務台應用程式 osTicket 是以開放原始碼的形式提供。The service desk application used in this example, osTicket, is provided as open source. 如果您想要將它用於自己的測試,您可以從 GitHub下載。If you want to use it for your own testing, you can download it from GitHub.

商業動機Business drivers

IT 領導小組與商務合作夥伴密切合作,瞭解他們想要達成的目標:The IT leadership team has worked closely with business partners to understand what they want to achieve:

  • 解決業務成長。Address business growth. Contoso 的業務量日益增多,對內部部署系統和基礎結構造成了壓力。Contoso is growing, and as a result there's pressure on the on-premises systems and infrastructure.
  • 限制風險。Limit risk. 服務台應用程式對企業至關重要。The service desk application is critical for the business. Contoso 想要在亳無風險的情況下,將它移至 Azure。Contoso wants to move it to Azure with zero risk.
  • 擴展。Extend. Contoso 不想立即變更應用程式。Contoso doesn't want to change the application right now. 公司想要讓應用程式保持穩定。The company wants to keep the application stable.

移轉目標Migration goals

Contoso 雲端小組已將此遷移的目標釘選為判斷最佳的遷移方法:The Contoso cloud team has pinned down goals for this migration to determine the best migration method:

  • 在遷移之後,Azure 中的應用程式應該具有與現今公司內部部署 VMware 環境中相同的效能功能。After migration, the application in Azure should have the same performance capabilities as it does today in the company's on-premises VMware environment. 應用程式在內部部署環境中將會保持在雲端中的重要性。The application will remain as critical in the cloud as it is on-premises.
  • Contoso 不想要投資此應用程式。Contoso doesn't want to invest in this application. 這對企業很重要,但以其目前的形式而言,Contoso 只會想要將它安全地移至雲端。It's important to the business, but in its current form Contoso simply wants to move it safely to the cloud.
  • Contoso 想要瞭解如何在 Azure 中使用以 Linux 為基礎的基礎結構,以完成幾個 Windows 應用程式遷移。Having completed a couple of Windows application migrations, Contoso wants to learn how to use a Linux-based infrastructure in Azure.
  • 將應用程式移到雲端之後,Contoso 想要將資料庫管理工作減到最少。Contoso wants to minimize database admin tasks after the application is moved to the cloud.

建議的架構Proposed architecture

在此情節中:In this scenario:

  • 應用程式目前在兩個 Vm 之間分層 (OSTICKETWEBOSTICKETMYSQL) 。Currently the application is tiered across two VMs (OSTICKETWEB and OSTICKETMYSQL).

  • VM 位於 VMware ESXi 主機 contosohost1.contoso.com(6.5 版)。The VMs are located on VMware ESXi host contosohost1.contoso.com (version 6.5).

  • VMware 環境是由 vCenter Server 6.5 () 來管理 vcenter.contoso.com ,並在 VM 上執行。The VMware environment is managed by vCenter Server 6.5 (vcenter.contoso.com) and runs on a VM.

  • Contoso 有內部部署資料中心 (contoso-datacenter) 以及內部部署網域控制站 (contosodc1)。Contoso has an on-premises datacenter (contoso-datacenter), with an on-premises domain controller (contosodc1).

  • 上的 web 應用程式 OSTICKETWEB 將會遷移至 Azure 基礎結構即服務 (IaaS) VM。The web application on OSTICKETWEB will be migrated to an Azure infrastructure as a service (IaaS) VM.

  • 應用程式資料庫將會遷移至適用於 MySQL 的 Azure 資料庫的平臺即服務。The application database will be migrated to the Azure Database for MySQL platform as a service.

  • 因為 Contoso 正在遷移生產工作負載,所以資源會位於生產資源群組中 ContosoRGBecause Contoso is migrating a production workload, the resources will reside in the production resource group ContosoRG.

  • OSTICKETWEB資源將會複寫到主要區域 (美國東部 2) 並放置於生產網路 (VNET-PROD-EUS2) :The OSTICKETWEB resource will be replicated to the primary region (East US 2) and placed in the production network (VNET-PROD-EUS2):

    • Web VM 會位於前端子網路 (PROD-FE-EUS2) 中。The web VM will reside in the front-end subnet (PROD-FE-EUS2).
  • 應用程式資料庫將會使用 Azure 資料庫移轉服務遷移至適用於 MySQL 的 Azure 資料庫。The application database will be migrated to Azure Database for MySQL by using Azure Database Migration Service.

  • 移轉完成之後,將會解除委任 Contoso 資料中心的內部部署 VM。The on-premises VMs in the Contoso datacenter will be decommissioned after the migration is done.

    案例架構的圖表。

移轉程序Migration process

Contoso 會按照下列方式完成移轉程序:Contoso will complete the migration process as follows:

若要遷移 Web VM:To migrate the web VM:

  • 在第一個步驟中,Contoso 會設定部署 Azure Migrate 所需的 Azure 和內部部署基礎結構。As a first step, Contoso sets up the Azure and on-premises infrastructure needed to deploy Azure Migrate.
  • 公司已有 Azure 基礎結構 ,因此只需要透過 Azure Migrate:伺服器遷移工具來新增和設定 vm 的複寫。The company already has the Azure infrastructure in place, so it just needs to add and configure the replication of the VMs through the Azure Migrate: Server Migration tool.
  • 一切準備就緒之後,Contoso 就可以開始複寫 VM。With everything prepared, Contoso can start replicating the VM.
  • 啟用複寫並正常運作之後,Contoso 會使用 Azure Migrate 完成移動。After replication is enabled and working, Contoso will complete the move by using Azure Migrate.

若要遷移資料庫:To migrate the database:

  1. Contoso 會在 Azure 中佈建 MySQL 執行個體。Contoso provisions a MySQL instance in Azure.

  2. Contoso 會設定資料庫移轉服務,以確保對內部部署資料庫伺服器的存取。Contoso sets up Database Migration Service, ensuring access to the on-premises database server.

  3. Contoso 會將資料庫移轉至適用於 MySQL 的 Azure 資料庫。Contoso migrates the database to Azure Database for MySQL.

    遷移程式的圖表。

Azure 服務Azure services

服務Service 描述Description 成本Cost
Azure MigrateAzure Migrate Contoso 會使用 Azure Migrate 來評定其 VMware Vm。Contoso uses Azure Migrate to assess its VMware VMs. Azure Migrate 會評定機器是否適合移轉。Azure Migrate assesses the migration suitability of the machines. 它會提供在 Azure 中執行的大小調整建議和成本估計。It provides sizing and cost estimates for running in Azure. Azure Migrate 可免費使用。Azure Migrate is available at no additional charge. 您可能會產生費用,取決於您決定要用於評量和遷移的 (第一方或 ISV) 工具。You might incur charges depending on the tools (first-party or ISV) you decide to use for assessment and migration.
Azure 資料庫移轉服務Azure Database Migration Service 資料庫移轉服務可讓您從多個資料庫來源順暢地遷移到 Azure 資料平臺,並減少停機時間。Database Migration Service enables seamless migration from multiple database sources to Azure data platforms with minimal downtime. 深入了解支援的區域資料庫移轉服務定價Learn about supported regions and Database Migration Service pricing.
適用於 MySQL 的 Azure 資料庫Azure Database for MySQL 資料庫是以開放原始碼 MySQL 資料庫引擎為基礎。The database is based on the open-source MySQL database engine. 它為應用程式開發和部署提供完全受控的企業專用的 MySQL 資料庫。It provides a fully managed enterprise-ready community MySQL database for application development and deployment. 深入瞭解適用於 MySQL 的 Azure 資料庫 定價 和擴充性選項。Learn more about Azure Database for MySQL pricing and scalability options.

必要條件Prerequisites

以下是 Contoso 在此案例中應該準備好的事項。Here's what Contoso needs for this scenario.

需求Requirements 詳細資料Details
Azure 訂用帳戶Azure subscription Contoso 在先前文章期間已建立訂用帳戶。Contoso created subscriptions during an earlier article. 如果您沒有 Azure 訂用帳戶,請建立免費帳戶If you don't have an Azure subscription, create a free account.

如果您建立免費帳戶,您就是訂用帳戶的管理員,並可執行所有動作。If you create a free account, you're the administrator of your subscription and can perform all actions.

如果您使用現有的訂用帳戶,而且您不是系統管理員,請與系統管理員合作,指派擁有者或參與者許可權給您。If you use an existing subscription and you're not the administrator, work with the admin to assign you Owner or Contributor permissions.

如果您需要更細微的許可權,請參閱 使用角色型存取控制來管理 Azure Site Recovery 存取 (RBAC) If you need more granular permissions, see Manage Azure Site Recovery access with role-based access control (RBAC).
Azure 基礎結構Azure infrastructure Contoso 會如適用於移轉的 Azure 基礎結構中所述,設定 Azure 基礎結構。Contoso set up the Azure infrastructure as described in Azure infrastructure for migration.
內部部署伺服器On-premises servers 內部部署 vCenter Server 應執行5.5、6.0、6.5 或6.7 版。The on-premises vCenter Server should be running version 5.5, 6.0, 6.5, or 6.7.

執行5.5、6.0、6.5 或6.7 版本的 ESXi 主機。An ESXi host running version 5.5, 6.0, 6.5, or 6.7.

一或多部在 ESXi 主機上執行的 VMware VM。One or more VMware VMs running on the ESXi host.
內部部署 VMOn-premises VMs 檢閱已背書在 Azure 上執行的 Linux 機器Review Linux machines that are endorsed to run on Azure.

案例步驟Scenario steps

以下是 Contoso 管理員完成移轉的方式:Here's how Contoso admins will complete the migration:

  • 步驟1:準備 Azure 以進行 Azure Migrate:伺服器遷移。Step 1: Prepare Azure for Azure Migrate: Server Migration. 將伺服器遷移工具新增至 Azure Migrate 專案。Add the server migration tool to the Azure Migrate project.
  • 步驟2:準備內部部署 VMware 以進行 Azure Migrate:伺服器遷移。Step 2: Prepare on-premises VMware for Azure Migrate: Server Migration. 準備帳戶以進行 VM 探索,並準備在遷移之後連線到 Azure 虛擬機器。Prepare accounts for VM discovery and prepare to connect to Azure Virtual Machines after migrated.
  • 步驟3:複寫 Vm。Step 3: Replicate VMs. 設定複寫並開始將 Vm 複寫至 Azure 儲存體。Set up replication and start replicating VMs to Azure Storage.
  • 步驟4:使用 Azure Migrate:伺服器遷移來遷移應用程式 VM。Step 4: Migrate the application VM with Azure Migrate: Server Migration. 執行測試遷移以確定一切都正常運作,然後執行完整遷移以將 VM 移至 Azure。Run a test migration to make sure everything's working, and then run a full migration to move the VM to Azure.
  • 步驟5:遷移資料庫。Step 5: Migrate the database. 使用 Azure 資料庫移轉服務設定遷移。Set up migration by using Azure Database Migration Service.

步驟1:準備 Azure 以進行 Azure Migrate:伺服器遷移工具Step 1: Prepare Azure for the Azure Migrate: Server Migration tool

以下是 Contoso 將 VM 移轉至 Azure 時,所需的 Azure 元件:Here are the Azure components Contoso needs to migrate the VMs to Azure:

  • 當 Azure Vm 在遷移期間建立時,將位於其中的虛擬網路。A virtual network in which Azure VMs will be located when they're created during migration.
  • Azure Migrate:伺服器遷移工具 (OVA) 布建和設定。The Azure Migrate: Server Migration tool (OVA) provisioned and configured.

若要設定元件,Contoso 管理員可遵循下列步驟:To set up the components, Contoso admins follow these steps:

  1. 設定網路。Set up a network. Contoso 已設定可用於 Azure Migrate:在 部署 Azure 基礎結構時進行伺服器遷移的網路。Contoso already set up a network that can be used for Azure Migrate: Server Migration when it deployed the Azure infrastructure.

  2. 布建 Azure Migrate:伺服器遷移工具。Provision the Azure Migrate: Server Migration tool.

    1. 從 Azure Migrate 下載 OVA 映射,並將其匯入 VMware。From Azure Migrate, download the OVA image, and import it into VMware.

      顯示下載 OVA 檔案的螢幕擷取畫面。

    2. 啟動匯入的映射,並使用下列步驟來設定工具:Start the imported image, and configure the tool by using the following steps:

      1. 設定必要條件。Set up the prerequisites.

        [設定必要條件] 頁面的螢幕擷取畫面。

      2. 將工具指向 Azure 訂用帳戶。Point the tool to the Azure subscription.

        設定訂用帳戶的螢幕擷取畫面。

      3. 設定 VMware vCenter 認證。Set the VMware vCenter credentials.

        顯示設定認證的螢幕擷取畫面。

      4. 新增任何以 Linux 為基礎的認證進行探索。Add any Linux-based credentials for discovery.

        顯示設定以 Linux 為基礎之認證的螢幕擷取畫面。

  3. 設定工具之後,工具會花一些時間來列舉所有的虛擬機器。After the tool is configured, it takes some time for the tool to enumerate all the virtual machines. 程式完成之後,Vm 會填入 Azure 中的 Azure Migrate 工具。After the process is finished, the VMs populate in the Azure Migrate tool in Azure.

需要其他協助?Need more help?

瞭解如何設定 Azure Migrate:伺服器遷移工具Learn about how to set up the Azure Migrate: Server Migration tool.

步驟2:準備內部部署 VMware 以進行 Azure Migrate:伺服器遷移Step 2: Prepare on-premises VMware for Azure Migrate: Server Migration

遷移至 Azure 之後,Contoso 希望能夠連線到 Azure 中複寫的 Vm。After migrating to Azure, Contoso wants to be able to connect to the replicated VMs in Azure. Contoso 管理員需要執行幾項工作:There are a couple of things that the Contoso admins need to do:

  • 若要存取 Azure Vm,它們會在遷移前先在內部部署 Linux VM 上啟用 SSH。To access Azure VMs, they enable SSH on the on-premises Linux VM before migration. 若為 Ubuntu,可以使用下列命令來完成此步驟: sudo apt-get ssh install -yFor Ubuntu, this step can be completed by using the following command: sudo apt-get ssh install -y.
  • 當系統管理員執行遷移之後,他們就可以檢查 開機診斷 以查看 VM 的螢幕擷取畫面。After the admins run the migration, they can check boot diagnostics to view a screenshot of the VM.
  • 如果無法運作,他們將需要檢查 VM 是否正在執行,並檢查這些 疑難排解秘訣If it doesn't work, they'll need to check that the VM is running, and review these troubleshooting tips.
  • 安裝 Azure Linux 代理程式Install the Azure Linux agent.

需要其他協助?Need more help?

瞭解如何 準備 vm 以進行遷移Learn about how to prepare VMs for migration.

步驟3:複寫 VmStep 3: Replicate VMs

Contoso 管理員必須先設定並啟用複寫,才能執行移轉至 Azure 的作業。Before Contoso admins can run a migration to Azure, they need to set up and enable replication.

完成探索之後,他們就可以開始將應用程式 VM 複寫至 Azure。With discovery finished, they can begin replication of the application VM to Azure.

  1. 在 Azure Migrate 專案中,移至 [伺服器 > Azure Migrate:伺服器遷移], 然後選取 [複寫]。In the Azure Migrate project, go to Servers > Azure Migrate: Server Migration, and select Replicate.

    顯示 [複寫] 選項的螢幕擷取畫面。

  2. [ 複寫 > 來源設定] 中,您的 > 電腦虛擬化了嗎? 請選取 [是],VMware vSphereIn Replicate > Source settings > Are your machines virtualized?, select Yes, with VMware vSphere.

  3. 在 [ 內部部署應用裝置] 中,選取您所設定 Azure Migrate 設備的名稱,然後選取 [確定]In On-premises appliance, select the name of the Azure Migrate appliance that you set up, and then select OK.

    顯示 [來源設定] 索引標籤的螢幕擷取畫面。

  4. 在 [ 虛擬機器] 中,選取您要複寫的機器:In Virtual machines, select the machines you want to replicate:

    • 如果您已執行 VM 的評估,您可以套用評估結果中的 VM 大小調整和磁碟類型 (進階/標準) 建議。If you've run an assessment for the VMs, you can apply VM sizing and disk type (premium/standard) recommendations from the assessment results. 在 [ 從 Azure Migrate 評量匯入遷移設定?] 中,選取 [ 是] 選項。In Import migration settings from an Azure Migrate assessment?, select the Yes option.
    • 如果您未執行評量,或不想使用評量設定,請選取 [ ] 選項。If you didn't run an assessment, or you don't want to use the assessment settings, select the No option.
    • 如果您選擇使用評量,請選取 VM 群組和評量名稱。If you selected to use the assessment, select the VM group and assessment name.

    顯示選取評定的螢幕擷取畫面。

  5. 虛擬機器 中,視需要搜尋 vm,然後選取您想要遷移的每個 vm。In Virtual machines, search for VMs as needed, and select each VM you want to migrate. 然後選取 [下一步:目標設定]Then select Next: Target settings.

  6. 在 [ 目標設定] 中,選取您要遷移的訂用帳戶和目的地區域。In Target settings, select the subscription and target region to which you'll migrate. 指定 Azure Vm 在遷移後將位於其中的資源群組。Specify the resource group in which the Azure VMs will reside after migration. 在 [ 虛擬網路] 中,選取 azure vm 在遷移後將加入的 azure 虛擬網路/子網。In Virtual Network, select the Azure virtual network/subnet to which the Azure VMs will be joined after migration.

  7. 在 [Azure Hybrid Benefit] 中:In Azure Hybrid Benefit:

    • 如果您不想套用 Azure Hybrid Benefit,請選取 [否]。Select No if you don't want to apply Azure Hybrid Benefit. 然後選取 [下一步]。Then select Next.
  8. 在 [計算] 中,檢閱 VM 名稱、大小、OS 磁碟類型和可用性設定組。In Compute, review the VM name, size, OS disk type, and availability set. VM 必須符合 Azure 需求VMs must conform with Azure requirements.

    • VM 大小: 如果您使用評量建議,[VM 大小] 下拉式清單會包含建議的大小。VM size: If you use assessment recommendations, the VM size drop-down list contains the recommended size. 否則,Azure Migrate 會根據 Azure 訂用帳戶中最接近的相符項來挑選大小。Otherwise, Azure Migrate picks a size based on the closest match in the Azure subscription. 或者,您可以在 [Azure VM 大小] 中手動選擇大小。Alternatively, pick a manual size in Azure VM size.
    • 作業系統磁片: 為 VM 指定作業系統 (開機) 磁片。OS disk: Specify the OS (boot) disk for the VM. OS 磁碟是具有作業系統開機載入器和安裝程式的磁碟。The OS disk is the disk that has the operating system bootloader and installer.
    • 可用性設定組: 如果 VM 在遷移後應位於 Azure 可用性設定組中,請指定集合。Availability set: If the VM should be in an Azure availability set after migration, specify the set. 此設定組必須位於您為移轉指定的目標資源群組中。The set must be in the target resource group you specify for the migration.
  9. 在 [ 磁片] 中,指定是否應將 VM 磁片複寫至 Azure。In Disks, specify whether the VM disks should be replicated to Azure. 然後選取 Azure 中 (標準 SSD/HDD 或 premium 受控磁片) 的磁片類型,然後選取 [下一步]Then select the disk type (standard SSD/HDD or premium-managed disks) in Azure, and select Next.

    • 您可以從複寫排除磁碟。You can exclude disks from replication.
    • 如果您排除磁片,則在遷移後將不會出現在 Azure VM 上。If you exclude disks, they won't be present on the Azure VM after migration.
  10. 在 [ 檢查 + 開始 複寫] 中,檢查設定。In Review + Start replication, review the settings. 然後選取 [ 複寫] 以啟動伺服器的初始複寫。Then select Replicate to start the initial replication for the servers.

注意

您可以在複寫開始之前隨時更新複寫設定,以 管理 複寫 > 機器You can update replication settings any time before replication starts in Manage > Replicating machines. 在複寫啟動後,就無法變更設定。Settings can't be changed after replication starts.

步驟4:使用 Azure Migrate:伺服器遷移來遷移 VMStep 4: Migrate the VM with Azure Migrate: Server Migration

Contoso 管理員會執行快速測試遷移,然後執行完整遷移來移動 web VM。Contoso admins run a quick test migration and then a full migration to move the web VM.

執行測試移轉Run a test migration

  1. 在 [遷移目標 > 伺服器 > Azure Migrate:伺服器遷移] 中,選取 [測試遷移的伺服器]。In Migration goals > Servers > Azure Migrate: Server Migration, select Test migrated servers.

    顯示 [測試遷移的伺服器] 選項的螢幕擷取畫面。

  2. 選取並保存 (或以滑鼠右鍵按一下) 要測試的 VM,然後選取 [ 測試遷移]。Select and hold (or right-click) the VM to test, and then select Test migrate.

    顯示測試遷移專案的螢幕擷取畫面。

  3. 在 [測試移轉] 中,選取 Azure VM 在移轉後將位於其中的 Azure 虛擬網路。In Test Migration, select the Azure virtual network in which the Azure VM will be located after the migration. 建議您使用非生產虛擬網路。We recommend you use a nonproduction virtual network.

  4. 測試移轉 作業隨即啟動。The Test migration job starts. 請在入口網站通知中監視作業。Monitor the job in the portal notifications.

  5. 移轉完成之後,請在 Azure 入口網站的 [虛擬機器] 中檢視已遷移的 Azure VM。After the migration finishes, view the migrated Azure VM in Virtual Machines in the Azure portal. 機器名稱會具有尾碼 -TestThe machine name has a suffix -Test.

  6. 測試完成後,請選取並保存 (或以滑鼠右鍵按一下) 複寫 機器 中的 Azure VM。After the test is done, select and hold (or right-click) the Azure VM in Replicating machines. 然後選取 [ 清除測試遷移]。Then select Clean up test migration.

    顯示清除測試遷移專案的螢幕擷取畫面。

移轉 VMMigrate the VM

Contoso 管理員現在會執行完整遷移來完成移動。Now Contoso admins run a full migration to complete the move.

  1. 在 Azure Migrate 專案中,移至 [伺服器 > Azure Migrate:伺服器遷移],然後選取 [複寫 伺服器]。In the Azure Migrate project, go to Servers > Azure Migrate: Server Migration, and select Replicating servers.

    顯示 [複寫伺服器] 選項的螢幕擷取畫面。

  2. 在 [複寫 機器] 中,選取並按住 (或以滑鼠右鍵按一下) VM,然後選取 [ 遷移]。In Replicating machines, select and hold (or right-click) the VM, and then select Migrate.

  3. 在 [遷移] > [將虛擬機器關機,在沒有資料遺失的情況下執行計劃性移轉] 中,選取 [是] > [確定]。In Migrate > Shut down virtual machines and perform a planned migration with no data loss, select Yes > OK.

    • 根據預設,Azure Migrate 會關閉內部部署 VM,並執行隨選複寫來同步處理自從上次複寫之後發生的任何 VM 變更。By default, Azure Migrate shuts down the on-premises VM and runs an on-demand replication to synchronize any VM changes that occurred since the last replication occurred. 此動作可確保不會遺失任何資料。This action ensures no data loss.
    • 如果您不想關閉 VM,請選取 [否]。If you don't want to shut down the VM, select No.
  4. VM 會啟動移轉作業。A migration job starts for the VM. 請在 Azure 通知中追蹤該作業。Track the job in Azure notifications.

  5. 作業完成後,您可以從 [虛擬機器] 頁面檢視及管理 VM。After the job finishes, you can view and manage the VM from the Virtual Machines page.

步驟5:布建適用於 MySQL 的 Azure 資料庫Step 5: Provision Azure Database for MySQL

Contoso 管理員會在主要區域中布建 MySQL 資料庫實例 (East US 2) 。Contoso admins provision a MySQL database instance in the primary region (East US 2).

  1. 在 Azure 入口網站中,建立適用於 MySQL 的 Azure 資料庫資源。In the Azure portal, create an Azure Database for MySQL resource.

    顯示適用於 MySQL 的 Azure 資料庫選項的螢幕擷取畫面。

  2. 新增 contosoosticket Azure 資料庫的名稱。Add the name contosoosticket for the Azure database. 將資料庫新增至生產資源群組 ContosoRG ,並為其指定認證。Add the database to the production resource group ContosoRG, and specify credentials for it.

  3. 內部部署 MySQL 資料庫是版本5.7,因此請選取此版本的相容性。The on-premises MySQL database is version 5.7, so select this version for compatibility. 使用符合資料庫需求的預設大小。Use the default sizes, which match database requirements.

    顯示 MySQL 認證的螢幕擷取畫面。

  4. 針對 [ 備份冗余] 選項,請選取 [ 地理位置多餘]。For Backup Redundancy Options, select Geo-Redundant. 此選項可讓您在次要區域中還原資料庫, (Central US) 是否發生中斷情況。This option allows you to restore the database in the secondary region (Central US) if an outage occurs. 只有在您布建資料庫時,才可以設定這個選項。You can configure this option only when you provision the database.

    顯示 Geo-Redundant 選項的螢幕擷取畫面。

  5. VNET-PROD-EUS2 網路中,移至 [ 服務端點],然後將服務端點新增 (SQL 服務的資料庫子網) 。In the VNET-PROD-EUS2 network, go to Service endpoints, and add a service endpoint (a database subnet) for the SQL service.

    顯示加入服務端點的螢幕擷取畫面。

  6. 新增子網之後,請建立虛擬網路規則,以允許從生產網路中的資料庫子網進行存取。After adding the subnet, create a virtual network rule that allows access from the database subnet in the production network.

    顯示建立虛擬網路規則的螢幕擷取畫面。

步驟 6:遷移資料庫Step 6: Migrate the database

有幾種方式可以移動 MySQL 資料庫。There are several ways to move the MySQL database. 每個選項都會要求 Contoso 系統管理員建立目標的適用於 MySQL 的 Azure 資料庫實例。Each option requires the Contoso admins to create an Azure Database for MySQL instance for the target. 建立之後,可以使用下列步驟中所述的兩個路徑來執行遷移:After it's created, they can perform the migration by using two paths that are described in the following steps:

  • 6a:資料庫移轉服務6a: Database Migration Service
  • 6b: MySQL 工作臺備份和還原6b: MySQL Workbench backup and restore

步驟6a:透過資料庫移轉服務遷移資料庫Step 6a: Migrate the database via Database Migration Service

Contoso 管理員會依照 逐步進行遷移教學課程,透過資料庫移轉服務來遷移資料庫。Contoso admins migrate the database via Database Migration Service by following the step-by-step migration tutorial. 他們可以使用 MySQL 5.6 或5.7 來執行線上、離線和混合式 (預覽版) 的遷移。They can perform online, offline, and hybrid (preview) migrations by using MySQL 5.6 or 5.7.

注意

適用於 MySQL 的 Azure 資料庫支援 MySQL 8.0,但資料庫移轉服務工具尚不支援該版本。MySQL 8.0 is supported in Azure Database for MySQL, but the Database Migration Service tool doesn't yet support that version.

為了摘要,Contoso 管理員必須執行下列工作:As a summary, Contoso admins must perform the following tasks:

  • 確定已符合所有的遷移必要條件:Ensure all migration prerequisites are met:
    • MySQL 伺服器資料庫來源必須符合適用於 MySQL 的 Azure 資料庫支援的版本。The MySQL server database source must match the version that Azure Database for MySQL supports. 適用於 MySQL 的 Azure 資料庫支援 MySQL 社區版、InnoDB 儲存引擎,以及使用相同版本跨來源和目標進行遷移。Azure Database for MySQL supports MySQL Community Edition, the InnoDB storage engine, and migration across the source and target with the same versions.
    • my.ini (Windows) 或 my.cnf (Unix) 啟用二進位記錄。Enable binary logging in my.ini (Windows) or my.cnf (Unix). 若未這麼做,將會在遷移嚮導中產生下列錯誤: Error in binary logging. Variable binlog_row_image has value 'minimal.' Please change it to 'full.' 如需詳細資訊,請參閱 MySQL 檔Failure to do so will cause the following error in the Migration Wizard: Error in binary logging. Variable binlog_row_image has value 'minimal.' Please change it to 'full.' For more information, see the MySQL documentation.
    • 使用者必須有 ReplicationAdmin 角色。User must have ReplicationAdmin role.
    • 在不包含外鍵和觸發程式的情況下遷移資料庫架構。Migrate the database schemas without foreign keys and triggers.
  • 建立透過 Azure ExpressRoute 或 VPN 連接到內部部署網路的虛擬網路。Create a virtual network that connects via Azure ExpressRoute or a VPN to your on-premises network.
  • 使用連線到虛擬網路的 SKU 來建立資料庫移轉服務實例 PremiumCreate a Database Migration Service instance by using a Premium SKU that's connected to the virtual network.
  • 確定實例可以透過虛擬網路存取 MySQL 資料庫。Ensure that the instance can access the MySQL database via the virtual network. 確定已在虛擬網路層級、網路 VPN 和裝載 MySQL 的電腦上,允許從 Azure 到 MySQL 的所有連入埠。Ensure that all incoming ports are allowed from Azure to MySQL at the virtual network level, the network VPN, and the machine that hosts MySQL.
  • 執行資料庫移轉服務工具:Run the Database Migration Service tool:
    • 建立移轉專案。Create a migration project.

      顯示建立遷移專案的螢幕擷取畫面。

      顯示 [新增遷移專案] 窗格的螢幕擷取畫面。

    • 將來源 (內部部署資料庫) 。Add a source (on-premises database).

      顯示 [新增來源詳細資料] 窗格的螢幕擷取畫面。

    • 選取目標。Select a target.

      顯示 [目標詳細資料] 窗格的螢幕擷取畫面。

    • 選取要遷移的資料庫。Select the databases to migrate.

      顯示 [目標資料庫的對應] 窗格的螢幕擷取畫面。

    • 設定 [advanced settings]。Configure advanced settings.

      顯示 [遷移設定] 窗格的螢幕擷取畫面。

    • 開始複寫並解決任何錯誤。Start the replication and resolve any errors.

      顯示錯誤解決方式的螢幕擷取畫面。

    • 執行最後的轉換。Perform the final cutover. 顯示最後轉換的螢幕擷取畫面。

      顯示完整切換窗格的螢幕擷取畫面。

      顯示 [遷移活動] 清單的螢幕擷取畫面。

    • 恢復任何外鍵和觸發程式。Reinstate any foreign keys and triggers.

    • 修改應用程式以使用新的資料庫。Modify applications to use the new database.

      顯示修改應用程式以使用新資料庫的螢幕擷取畫面。

步驟6b:將資料庫移轉 (MySQL 工作臺) Step 6b: Migrate the database (MySQL Workbench)

Contoso 管理員會使用 [使用 MySQL 的備份和還原] 工具來遷移資料庫。Contoso admins migrate the database by using backup and restore with MySQL tools. 他們會安裝 MySQL 工作臺、備份資料庫,然後將 OSTICKETMYSQL 它還原至適用於 MySQL 的 Azure 資料庫。They install MySQL Workbench, back up the database from OSTICKETMYSQL, and then restore it to Azure Database for MySQL.

安裝 MySQL WorkbenchInstall MySQL Workbench

  1. 檢查 必要條件,並下載 MySQL 工作臺Check the prerequisites, and download MySQL Workbench.

  2. 遵循 安裝指示,安裝適用于 Windows 的 MySQL 工作臺。Install MySQL Workbench for Windows by following the installation instructions.

  3. 在 MySQL 工作臺中,建立 OSTICKETMYSQL 的 MySQL 連接。In MySQL Workbench, create a MySQL connection to OSTICKETMYSQL.

    顯示 [連接] 索引標籤的螢幕擷取畫面。

  4. 將資料庫匯出為 osticket 本機獨立檔案。Export the database as osticket to a local self-contained file.

    [資料匯出] 頁面的螢幕擷取畫面。

  5. 在本機備份資料庫之後,請建立適用於 MySQL 的 Azure 資料庫實例的連接。After the database is backed up locally, create a connection to the Azure Database for MySQL instance.

    顯示成功連接快顯訊息的螢幕擷取畫面。

  6. 現在,從獨立的檔案匯入 (restore) 適用於 MySQL 的 Azure 資料庫實例中的資料庫。Now, import (restore) the database in the Azure Database for MySQL instance from the self-contained file. 針對實例建立新的架構 (osticket) 。A new schema (osticket) is created for the instance.

    顯示 [從 Self-Contained 檔案匯入] 選項的螢幕擷取畫面。

將 VM 連線到資料庫Connect the VM to the database

在遷移程式的最後一個步驟中,Contoso 管理員會將應用程式的連接字串更新為指向在 VM 上執行的應用程式資料庫 OSTICKETMYSQLAs the final step in the migration process, Contoso admins update the connection string of the application to point to the application database running on the OSTICKETMYSQL VM.

  1. OSTICKETWEB使用 PuTTY 或另一個 ssh 用戶端,對 VM 進行 SSH 連線。Make an SSH connection to the OSTICKETWEB VM by using PuTTY or another SSH client. VM 是私用的,因此請使用私人 IP 位址進行連接。The VM is private, so connect by using the private IP address.

    顯示 [連接到虛擬機器] 窗格的螢幕擷取畫面。

    顯示資料庫連接的螢幕擷取畫面。

  2. 請確定 OSTICKETWEB vm 可以與 vm 進行通訊 OSTICKETMYSQLMake sure that the OSTICKETWEB VM can communicate with the OSTICKETMYSQL VM. 目前,設定會以內部部署 IP 位址進行硬式編碼 172.16.0.43Currently, the configuration is hardcoded with the on-premises IP address 172.16.0.43.

    更新之前:Before the update:

    顯示更新之前的 IP 螢幕擷取畫面。

    更新之後:After the update:

    顯示更新之後 IP 的螢幕擷取畫面。

  3. 使用重新開機服務 systemctl restart apache2Restart the service with systemctl restart apache2.

    顯示服務重新開機的螢幕擷取畫面。

  4. 最後, OSTICKETWEB OSTICKETMYSQL 在其中一個 Contoso 網域控制站上更新和的 DNS 記錄。Finally, update the DNS records for OSTICKETWEB and OSTICKETMYSQL on one of the Contoso domain controllers.

    顯示更新 DNS 記錄的螢幕擷取畫面。

    顯示更新 DNS 記錄的螢幕擷取畫面。

需要其他協助?Need more help?

檢閱部署Review the deployment

當應用程式正在執行時,Contoso 必須完全讓並保護其新的基礎結構。With the application now running, Contoso needs to fully operationalize and secure its new infrastructure.

移轉之後進行清除Clean up after migration

當完成遷移時,osTicket 應用層會在 Azure Vm 上執行。With migration complete, the osTicket application tiers are running on Azure VMs.

現在,Contoso 必須執行下列工作:Now, Contoso needs to do the following tasks:

  • 從 vCenter 清查中移除 VMware VM。Remove the VMware VMs from the vCenter inventory.
  • 從本機備份作業中移除內部部署 VM。Remove the on-premises VMs from local backup jobs.
  • 更新內部檔以顯示新的位置和 IP 位址。Update internal documentation to show new locations and IP addresses.
  • 檢查與內部部署 Vm 互動的任何資源。Review any resources that interact with the on-premises VMs. 更新任何相關的設定或文件,以反映新的組態。Update any relevant settings or documentation to reflect the new configuration.
  • Contoso 使用 Azure Migrate 搭配相依性對應來評定要 OSTICKETWEB 進行遷移的 VM。Contoso used Azure Migrate with dependency mapping to assess the OSTICKETWEB VM for migration.

安全性Security

Contoso 安全性小組會檢查 VM 和資料庫以判斷任何安全性問題:The Contoso security team reviews the VM and database to determine any security issues:

  • 他們會檢查 (Nsg) 的網路安全性群組,讓 VM 控制存取權。They review the network security groups (NSGs) for the VM to control access. NSG 可用來確保只可以傳遞該應用程式允許的流量。NSGs are used to ensure that only traffic allowed to the application can pass.
  • 他們會考慮使用 Azure 磁碟加密和 Azure Key Vault 來保護 VM 磁片上的資料。They consider securing the data on the VM disks by using Azure Disk Encryption and Azure Key Vault.
  • VM 與資料庫執行個體之間的通訊並未針對 SSL 進行設定。Communication between the VM and database instance isn't configured for SSL. 他們必須設定 SSL,以確保資料庫流量不會遭到駭客入侵。They'll need to configure SSL to ensure that database traffic can't be hacked.

如需詳細資訊,請參閱 Azure 中 IaaS 工作負載的安全性最佳作法For more information, see Security best practices for IaaS workloads in Azure.

商務持續性和災害復原Business continuity and disaster recovery

針對商務持續性和災害復原,Contoso 會採取下列動作:For business continuity and disaster recovery, Contoso takes the following actions:

  • 保持資料安全。Keep data safe. Contoso 會使用 AZURE VM 備份來備份應用程式 VM 上的資料。Contoso backs up the data on the application VM by using Azure VM backup. 公司不需要設定資料庫的備份。The company doesn't need to configure backup for the database. 適用於 MySQL 的 Azure 資料庫會自動建立及儲存伺服器備份。Azure Database for MySQL automatically creates and stores server backups. Contoso 已選擇使用資料庫的異地複寫,使其具有復原能力和生產環境。Contoso selected to use geo-redundancy for the database so that it's resilient and production ready.
  • 讓應用程式保持正常運作。Keep applications up and running. Contoso 會使用 Site Recovery,將 Azure 中的應用程式 Vm 複寫至次要區域。Contoso replicates the application VMs in Azure to a secondary region by using Site Recovery. 如需詳細資訊,請參閱 快速入門:針對 AZURE VM 設定損毀修復至次要 Azure 區域For more information, see Quickstart: Set up disaster recovery to a secondary Azure region for an Azure VM.

授權和成本最佳化Licensing and cost optimization

  • 部署資源之後,Contoso 會指派 azure 基礎結構 部署期間所定義的 azure 標記。After deploying resources, Contoso assigns Azure tags as defined during the Azure infrastructure deployment.
  • 他們沒有 Contoso Ubuntu 伺服器相關授權問題。There are no licensing issues for the Contoso Ubuntu servers.
  • Contoso 會使用 Azure 成本管理和帳單 來確保公司維持在 IT 領導階層所建立的預算內。Contoso will use Azure Cost Management and Billing to ensure the company stays within budgets established by the IT leadership.