共用方式為


更新 Azure Stack Hub 中的 MySQL 資源提供者

重要

從 Azure Stack Hub 組建 2108 開始,SQL 和 MySQL 資源提供者會提供給已授與存取權的訂用帳戶。 如果您想要開始使用這項功能,或需要從舊版升級,開啟支援案例,我們的支援工程師會引導您完成部署或升級程式。

重要

更新資源提供者之前,請先檢閱版本資訊,以瞭解可能會影響部署的新功能、修正程式和任何已知問題。 版本資訊也會指定資源提供者所需的最低 Azure Stack Hub 版本。

重要

更新資源提供者不會更新主控 MySQL 伺服器。

當 Azure Stack Hub 發行新的組建時,我們可能會發行新的 MySQL 資源提供者配接器。 雖然現有的配接器會繼續運作,但建議您儘快更新至最新的組建。

支援的 Azure Stack Hub 版本 MySQL RP 版本 執行 RP 服務的 Windows Server
2206, 2301, 2306, 2311 MySQL RP 2.0.13.x 版 Microsoft AzureStack 附加元件 RP Windows Server 1.2009.0
2108, 2206 MySQL RP 2.0.6.x 版 Microsoft AzureStack 插件 RP Windows Server 1.2009.0

更新 MySQL Server 資源提供者 V2

如果您已部署 MySQL RP V2 並想要檢查更新,請檢查 如何將更新套用至資源提供者

如果您想要從 MySQL RP V1 更新至 MySQL RP V2,請務必先更新 MySQL RP V1.1.93.x,然後套用主要版本升級程式,以從 MySQl RP V1 升級至 MySQL RP V2。

從 MySQL RP V1.1.93.x 更新至 MySQL RP V2.0.6.0

先決條件

  1. 請務必將 MySQL RP V1 更新為最新的 1.1.93.x。 在 [預設提供者訂用帳戶下,尋找 RP 資源群組(命名格式:system.<region>.mysqladapter)。 確認資源群組中的版本標籤和 MySQL RP VM 名稱。 如果您仍處於舊版,且需要更新至 1.1.93.x,請開啟支援案例以取得協助。

  2. 開啟支援案例 以取得MajorVersionUpgrade套件,並將您的訂用帳戶新增至未來的 V2 版本 ASH 市集允許清單。

  3. Microsoft AzureStack Add-On RP Windows Server 1.2009.0 下載至 Marketplace。

  4. 請確定您的 Azure Stack Hub 符合數據中心整合必要條件。

    先決條件 參考
    已正確設定條件式 DNS 轉送。 Azure Stack Hub 數據中心整合 - DNS
    資源提供者的輸入埠已開啟。 Azure Stack Hub 資料中心整合 - 埠和通訊協定輸入
    PKI 憑證主體和SAN已正確設定。 Azure Stack Hub 部署必要的 PKI 必要條件
    Azure Stack Hub 部署 PaaS 憑證必要條件
  5. ( 適用於中斷連線的環境 )安裝必要的 PowerShell 模組,類似於用來 部署 MySQL 資源提供者的更新程式。

  6. 準備具有必要版本的 MySQL 連接器 URI。 如需詳細資訊,請參閱 部署 MySQL 資源提供者。 例如 https://<storageAcountName>.blob。<區域>。<FQDN>/<containerName>/mysql-connector-net-8.0.21.msi

觸發 MajorVersionUpgrade

從提升許可權的 PowerShell 控制台執行下列腳本,以執行主要版本升級。

注意

請確保您執行腳本的用戶端電腦的作業系統版本不早於 Windows 10 或 Windows Server 2016,且用戶端電腦具有 x64 位元作業系統架構。

重要

強烈建議使用 Clear-AzureRmContext -Scope CurrentUserClear-AzureRmContext -Scope Process,在執行部署或更新腳本之前清除快取。

# Check Operating System version
$osVersion = [environment]::OSVersion.Version
if ($osVersion.Build -lt 10240)
{
    Write-Host "OS version is too old: $osVersion."
    return
}

$osArch = (Get-WmiObject Win32_OperatingSystem).OSArchitecture
if ($osArch -ne "64-bit")
{
    Write-Host "OS Architecture is not 64 bit."
    return
}

# Check LongPathsEnabled registry key
$regPath = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
$longPathsEnabled = 'LongPathsEnabled'
$property = Get-ItemProperty -Path $regPath -Name $longPathsEnabled -ErrorAction Stop
if ($property.LongPathsEnabled -eq 0)
{
    Write-Host "Detect LongPathsEnabled equals to 0, prepare to set the property."
    Set-ItemProperty -Path $regPath -Name $longPathsEnabled -Value 1 -ErrorAction Stop
    Write-Host "Set the long paths property, please restart the PowerShell."
    return
} 

# Use the NetBIOS name for the Azure Stack Hub domain. 
$domain = "YouDomain" 
# For integrated systems, use the IP address of one of the ERCS VMs
$privilegedEndpoint = "YouDomain-ERCS01"
# Provide the Azure environment used for deploying Azure Stack Hub. Required only for Azure AD deployments. Supported values for the <environment name> parameter are AzureCloud, AzureChinaCloud, or AzureUSGovernment depending which Azure subscription you're using.
$AzureEnvironment = "AzureCloud"
# Point to the directory where the resource provider installation files were extracted.
$tempDir = 'C:\extracted-folder\MajorVersionUpgrade-MySQLRP'
# The service admin account can be Azure Active Directory or Active Directory Federation Services.
$serviceAdmin = "admin@mydomain.onmicrosoft.com"
$AdminPass = ConvertTo-SecureString 'xxxxxxxx' -AsPlainText -Force
$AdminCreds = New-Object System.Management.Automation.PSCredential ($serviceAdmin, $AdminPass)
# Add the cloudadmin credential that's required for privileged endpoint access.
$CloudAdminPass = ConvertTo-SecureString 'xxxxxxxx' -AsPlainText -Force
$CloudAdminCreds = New-Object System.Management.Automation.PSCredential ("$domain\cloudadmin", $CloudAdminPass)
# Change the following as appropriate.
$PfxPass = ConvertTo-SecureString 'xxxxxxx' -AsPlainText -Force
# Provide the pfx file path
$PfxFilePath = "C:\tools\mysqlcert\SSL.pfx"
# Local blob uri where stores the required mysql connector
$MySQLConnector = "Provide the MySQL Connector Uri according to Prerequisites step."
# PowerShell modules used by the RP MajorVersionUpgrade are placed in C:\Program Files\SqlMySqlPsh
# The deployment script adds this path to the system $env:PSModulePath to ensure correct modules are used.
$rpModulePath = Join-Path -Path $env:ProgramFiles -ChildPath 'SqlMySqlPsh'
$env:PSModulePath = $env:PSModulePath + ";" + $rpModulePath 
. $tempDir\MajorVersionUpgradeMySQLProvider.ps1 -AzureEnvironment $AzureEnvironment -AzCredential $AdminCreds -CloudAdminCredential $CloudAdminCreds -Privilegedendpoint $privilegedEndpoint -PfxPassword $PfxPass -PfxCert $PfxFilePath -MySQLConnector $MySQLConnector

注意

MYSQL RP V2 的 DNS 位址和對應的 IP 位址不同。 若要取得新的公用IP,您可以聯絡支援團隊,要求啟動DRP緊急程序,並尋找 MySQLRPVM1130-PublicIP 資源。 您也可以從已經通過端點測試的用戶端機器上執行“nslookup mysqlrp.dbadapter.<fqdn>”,以找出公用 IP。

驗證升級是否成功

  1. MajorVersionUpgrade 腳本執行時沒有任何錯誤。
  2. 檢查 Marketplace 中的資源提供者,並確定已成功安裝 MySQL RP 2.0。
  3. 舊的 系統。<位置>.mysqladapter 資源群組和 系統。<位置>.dbadapter.dns 資源群組在預設提供者訂閱中將不會被腳本自動刪除。
  • 建議您在 mysqladapter 資源群組中保留記憶體帳戶和 Key Vault 一段時間。 如果在升級之後,任何租戶用戶觀察到資料庫或登入元數據不一致,則可以獲得支援以從資源群組還原元數據。
  • 確認 dbadapter.dns 資源群組中的 DNS 區域是空的,且沒有 DNS 記錄之後,可以安全地刪除 dbadapter.dns 資源群組。
  • [重要]請勿使用 V1 部署腳本來卸載 V1 版本。 升級完成並確認升級成功之後,您可以從提供者訂用帳戶手動刪除資源群組。

從 MySQL RP V1 舊版更新至 MySQL RP V1.1.93.x

MySQL 資源提供者 V1 更新是累積的。 您可以直接更新至 1.1.93.x 版本。

若要將資源提供者更新為 1.1.93.x,請使用 UpdateMySQLProvider.ps1 腳本。 使用具有本機系統管理許可權的服務帳戶,並且是訂用帳戶的 擁有者。 此更新文本隨附於資源提供者的下載中。

若要更新資源提供者,請使用 UpdateMySQLProvider.ps1 腳本。 使用擁有本機管理員權限的服務帳戶,並且是 訂用帳戶的擁有者。 更新腳本包含在資源提供者的下載中。

更新程式類似於用來 部署資源提供者的程式。 更新文稿會使用與 DeployMySqlProvider.ps1 腳稿相同的自變數,您必須提供憑證資訊。

更新腳本流程

UpdateMySQLProvider.ps1 文本會使用最新的OS映像建立新的虛擬機(VM),部署最新的資源提供者程序代碼,並將設定從舊的資源提供者移轉至新的資源提供者。

注意

建議您從 Marketplace 管理控制台下載 Microsoft AzureStack 附加元件 RP Windows Server 1.2009.0 映像檔。 如果您需要安裝更新,您可以將 單一 MSU 套件放置在本機相依路徑中。 如果此位置有多個 MSU 檔案,腳本將會失敗。

UpdateMySQLProvider.ps1 腳本建立新的 VM 之後,腳本會從舊的資源提供者 VM 移轉下列設定:

  • 資料庫資訊
  • 主機伺服器資訊
  • 必要的 DNS 記錄

重要

強烈建議使用 Clear-AzureRmContext -Scope CurrentUserClear-AzureRmContext -Scope Process,在執行部署或更新腳本之前清除快取。

更新文本參數

當您執行 UpdateMySQLProvider.ps1 PowerShell 腳稿時,請從命令行指定下列參數。 如果您未這麼做,或有任何參數驗證失敗,系統會提示您提供必要的參數。

參數名稱 描述 批註或預設值
CloudAdminCredential 雲端管理員的認證,存取特殊權限端點的必要認證。 必要
AzCredential Azure Stack Hub 服務管理員帳戶的認證。 使用您用來部署 Azure Stack Hub 的相同認證。 如果您搭配 AzCredential 使用的帳戶需要多重要素驗證(MFA),腳本將會失敗。 必要
VMLocalCredential MySQL 資源提供者 VM 之本機系統管理員帳戶的認證。 必要
特權端點 具特殊許可權端點的IP位址或 DNS 名稱。 必要(
AzureEnvironment 用來部署 Azure Stack Hub 之服務管理員帳戶的 Azure 環境。 僅適用於 Microsoft Entra 的部署。 支援的環境名稱 AzureCloudAzureUSGovernment,或使用 China Microsoft Entra ID,AzureChinaCloud AzureCloud
DependencyFilesLocalPath 您的憑證 .pfx 檔案也必須放在此目錄中。 選擇性(強制用於多節點
DefaultSSLCertificatePassword .pfx 憑證的密碼。 必要
MaxRetryCount 發生失敗時,您想要重試每個作業的次數。 2
重試時間 重試之間的逾時間隔,以秒為單位。 120
卸載 拿掉資源提供者和所有相關聯的資源(請參閱下列附注)。
DebugMode 防止失敗時自動清除。
AcceptLicense 略過提示以接受 GPL 授權。 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

更新文本範例

如果您要將 MySQL 資源提供者版本更新為 1.1.33.0 或舊版,您必須在 PowerShell 中安裝特定版本的 AzureRm.BootStrapper 和 Azure Stack Hub 模組。

如果您要將 MySQL 資源提供者更新至 1.1.47.0 版或更新版本,您可以略過此步驟。 部署腳本會自動下載並安裝必要的PowerShell模組,讓您前往 C:\Program Files\SqlMySqlPsh 路徑。

注意

如果下載 PowerShell 模組時已經存在 C:\Program Files\SqlMySqlPsh 資料夾,建議您在執行更新腳本之前清除此資料夾。 這是為了確保已下載並使用正確的 PowerShell 模組版本。

# Run the following scripts when updating to version 1.1.33.0 only.
# Install the AzureRM.Bootstrapper module, set the profile and install the AzureStack module.
# Note that this might not be the most currently available version of Azure Stack Hub PowerShell.
Install-Module -Name AzureRm.BootStrapper -Force
Use-AzureRmProfile -Profile 2018-03-01-hybrid -Force
Install-Module -Name AzureStack -RequiredVersion 1.6.0

注意

在中斷連線的案例中,您必須下載必要的 PowerShell 模組,並手動註冊存放庫作為必要條件。 您可以在部署 MySQL 資源提供者 取得更多詳細資訊

下列範例顯示您可以從高權限的 PowerShell 控制台執行的 UpdateMySQLProvider.ps1 腳本。 請務必視需要變更變數信息和密碼:

# Use the NetBIOS name for the Azure Stack Hub domain. On the Azure Stack Hub SDK, the default is AzureStack but could have been changed at install time.
$domain = "AzureStack" 

# For integrated systems, use the IP address of one of the ERCS VMs.
$privilegedEndpoint = "AzS-ERCS01" 

# Provide the Azure environment used for deploying Azure Stack Hub. Required only for Azure AD deployments. Supported environment names are AzureCloud, AzureUSGovernment, or AzureChinaCloud. 
$AzureEnvironment = "<EnvironmentName>"

# Point to the directory where the resource provider installation files were extracted. 
$tempDir = 'C:\TEMP\MYSQLRP' 

# The service admin account (can be Azure Active Directory or Active Directory Federation Services).
$serviceAdmin = "admin@mydomain.onmicrosoft.com" 
$AdminPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force 
$AdminCreds = New-Object System.Management.Automation.PSCredential ($serviceAdmin, $AdminPass) 
 
# Set credentials for the new resource provider VM.
$vmLocalAdminPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force 
$vmLocalAdminCreds = New-Object System.Management.Automation.PSCredential ("mysqlrpadmin", $vmLocalAdminPass) 
 
# And the cloudadmin credential required for privileged endpoint access.
$CloudAdminPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force 
$CloudAdminCreds = New-Object System.Management.Automation.PSCredential ("$domain\cloudadmin", $CloudAdminPass) 

# Change the following as appropriate.
$PfxPass = ConvertTo-SecureString 'P@ssw0rd1' -AsPlainText -Force 

# For version 1.1.47.0 or later, the PowerShell modules used by the RP deployment are placed in C:\Program Files\SqlMySqlPsh
# The deployment script adds this path to the system $env:PSModulePath to ensure correct modules are used.
$rpModulePath = Join-Path -Path $env:ProgramFiles -ChildPath 'SqlMySqlPsh'
$env:PSModulePath = $env:PSModulePath + ";" + $rpModulePath 

# Change directory to the folder where you extracted the installation files.
# Then adjust the endpoints.
.$tempDir\UpdateMySQLProvider.ps1 -AzCredential $AdminCreds -VMLocalCredential $vmLocalAdminCreds -CloudAdminCredential $cloudAdminCreds -PrivilegedEndpoint $privilegedEndpoint -AzureEnvironment $AzureEnvironment -DefaultSSLCertificatePassword $PfxPass -DependencyFilesLocalPath $tempDir\cert -AcceptLicense

當資源提供者更新文本完成時,請關閉目前的 PowerShell 工作階段。

後續步驟

維護 MySQL 資源提供者