部署 SQL Server 以取得 VMM 高可用性Deploy SQL Server for VMM high availability

重要

已不再支援此版本的 Virtual Machine Manager (VMM),建議升級至 VMM 2019This version of Virtual Machine Manager (VMM) has reached the end of support, we recommend you to upgrade to VMM 2019.

本文說明針對 System Center - Virtual Machine Manager (VMM) 部署高可用性 SQL Server 資料庫的步驟。This article describes the steps for deploying a highly available SQL Server database for System Center - Virtual Machine Manager (VMM). 您可以設定 SQL Server 叢集,以 AlwaysOn 可用性群組設定 SQL Server VMM 資料庫。You set up a SQL Server cluster, configure the SQL Server VMM database with Always On Availability Groups.

在您開始使用 Intune 之前Before you start

請閱讀適用於高可用性 VMM 部署的規劃資訊Read the planning information for a highly available VMM deployment. 其中包括先決條件和您應該要注意的問題。It includes prerequisites and issues you should be aware of.

設定可用性群組Set up availability groups

SQL Server AlwaysOn 可用性群組支援適用於一組特定使用者資料庫 (可用性資料庫) 的容錯移轉環境。SQL Server Always On availability groups support failover environments for a discrete set of user databases (availability databases). 每一組可用性資料庫均是透過可用性複本來裝載。Each set of availability databases is hosted by an availability replica. 若要設定可用性群組,您必須部署 Windows Server 容錯移轉叢集 (WSFC) 來裝載可用性複本,並在叢集節點上啟用 AlwaysOn。To set up an availability group you must deploy a Windows Server Failover Clustering (WSFC) cluster to host the availability replica, and enable Always On on the cluster nodes. 然後,您可以新增 VMM SQL Server 資料庫做為可用性資料庫。You can then add the VMM SQL Server database as an availability database.

以 AlwaysOn 可用性群組設定 VMM 資料庫Configure the VMM database with Always On Availability Groups

  1. 停止 VMM 伺服器上的 VMM 服務。On the VMM server, stop the VMM service. 對於叢集,在 [容錯移轉叢集管理員] 中,停止 VMM 角色。For a cluster, in Failover Cluster Manager, stop the VMM role.
  2. 連接到裝載 VMM 資料庫的電腦,然後在 SQL Server Management Studio 中,以滑鼠右鍵按一下 VMM 資料庫 > [內容] 。Connect to the machine that hosts the VMM database, and in SQL Server Management Studio, right-click the VMM database > Properties. 在 [選項] 中,將資料庫的 [復原模式] 設為 [完整] 。In Options, set the Recovery model for the database to Full.
  3. 以滑鼠右鍵按一下 VMM 資料庫 > [工作] > [備份] ,然後產生資料庫的備份。Right-click the VMM database > Tasks > Back Up and take a backup of the database.
  4. 在 SQL Server Management Studio 中 > [AlwaysOn 高可用性] > 以滑鼠右鍵按一下可用性群組名稱 > [新增資料庫] 。In SQL Server Management Studio > Always On High Availability > right-click the availability group name > Add Database.
  5. 在 [將資料庫加入至可用性群組] > [選取資料庫] 中,選取 VMM 資料庫。In Add Database to Availability Group > Select Databases, select the VMM database.
  6. 在 [選取資料同步處理] 中,保留 [完整] 的預設值。In Select Data Synchronization, leave the Full default.
  7. 在 [連接到複本] > [連接] 中,指定可用性群組目的地的權限。In Connect to Replicas > Connect, specify permissions for the availability group destination.
  8. 在 [驗證] 中檢查先決條件。Prerequisites are checked in Validation. 在 [摘要] 中,當您按一下 [下一步] 時,就會針對 VMM 資料庫起始 AlwaysOn 可用性支援。In Summary, when you click Next Always On availability support is initiated for the VMM database. VMM 資料庫會複製,而且從這裡開始,AlwaysOn 將會在 SQL Server AlwaysOn 叢集節點之間讓 VMM 資料庫保持同步。The VMM database is copied and from this point Always On keeps the VMM database synchronized between the SQL Server Always On cluster nodes.
  9. 重新啟動 VMM 服務或叢集角色。Restart the VMM service or cluster role. VMM 伺服器應該能夠連接到 SQL Server。The VMM server should be able to connect to the SQL Server.
  10. VMM 認證只會針對主要 SQL Server 進行儲存;因此,您需要在 SQL Server 叢集的次要節點上建立新的登入,並使其具有下列特性:VMM credentials are only stored for the main SQL Server, so you need to create a new login on the secondary node of the SQL Server cluster, with the following characteristics:
    • 登入名稱與 VMM 服務帳戶名稱相同。The login name is identical to the VMM service account name.
    • 登入帳戶具有與 VMM 資料庫的使用者對應。The login has the user mapping to the VMM database.
    • 登入帳戶使用資料庫擁有者認證設定。The login is configured with the database owner credentials.

執行容錯移轉Run a failover

若要針對 VMM 資料庫檢查 AlwaysOn 正如預期般運作,請在 SQL Server 叢集中從主要節點執行容錯移轉至次要節點。To check that Always On is working as expected for the VMM database, run a failover from the primary to secondary node in the SQL Server cluster.

  1. 在 SQL Server Management Studio 中,以滑鼠右鍵按一下次要伺服器上的可用性群組 > [容錯移轉] 。In SQL Server Management Studio, right-click the availability group on the secondary server > Failover.
  2. 在 [容錯移轉可用性群組] > [選取新的主要複本] 中,選取次要伺服器。In Fail Over Availability Group > Select New Primary Replica, select the secondary server.
  3. 在 [摘要] 中,按一下 [完成] 。In Summary, click Finish.
  4. 現在,藉由對執行 SQL Server 的次要節點電腦起始容錯移轉,並確認您可以重新啟動 VMM 服務 (scvmmservice),將其移回。Now move it back by initiating a failover to the secondary node computer that is running SQL Server, and verify that you can restart the VMM service (scvmmservice).
  5. 針對叢集中執行 SQL Server 的每個次要節點重複最後兩個步驟。Repeat the last two steps for every secondary node in the cluster that is running SQL Server.
  6. 如果這是高可用性 VMM 安裝,請繼續安裝其他高可用性 VMM 節點。If this is a high availability VMM setup, continue to install other high availability VMM nodes.

注意

若您在多子網路案例中遇到高延遲或逾時錯誤,請變更路徑 HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\Sql\ConnectionString 中的 VMM 連接字串,加上 MultiSubnetFailover=True;然後重新啟動 VMM 服務。If you are experiencing high latency or timeout errors in a multi-subnet scenario, change VMM connection string in the path HKLM\SOFTWARE\Microsoft\Microsoft System Center Virtual Machine Manager Server\Settings\Sql\ConnectionString, add MultiSubnetFailover=True; and restart the VMM service.