适用范围:SQL Server
除了通常的终结点,SQL Server 的 Azure Arc 扩展还连接到另外两个终结点:
数据处理服务 (DPS) 终结点
出于计费目的,有关 SQL Server 实例、数据库、可用性组和使用情况数据的收集清单信息将发送到此终结点。
遥测终结点
Azure Connected Machine 代理日志、SQL Server 的 Azure 扩展日志和动态管理视图 (DMV) 数据将发送到此终结点。
与这些终结点的通信使用具有 SSL/TLS 的 HTTPS 和端口 TCP/443,便于进行加密的安全连接。 代理会启动通信,以将数据发送到 Azure。 Azure 从不启动通信。 因此,连接到这些终结点只有一种方法。
当与这些终结点的通信被阻止时,服务会出现以下情况:
- 在 Azure 门户中看不到 SQL Server 实例。 DPS 终结点被阻止。
- 在 SQL Server 实例性能仪表板视图中看不到数据。 (如果 DPS 终结点已解锁,但遥测终结点被阻止)。
- 看到 Azure 门户中 SQL Server 的 Azure 扩展状态错误。 查看检查 Azure 门户中 SQL Server 的 Azure 扩展状态。
- 看到 SQL Server 的 Azure 扩展日志错误。 查看检查 SQL Server 的 Azure 扩展日志。
Azure 扩展当前状态
可在门户中查看 SQL Server 的 Azure 扩展的当前状态。 状态每 15 分钟刷新一次。
运行正常的状态:
运行不正常的状态:
检查连接到 DPS 或遥测终结点时是否有问题
有两种方法检查连接到 DPS 或遥测终结点时是否有问题。
检查 Azure 门户中 SQL Server 的 Azure 扩展状态
如果通常连接到 Azure,则 SQL Server 的 Azure 扩展会在 Azure 门户中报告其状态。
- 导航到 Azure 门户中的 Azure Arc- Machines视图,按名称找到计算机并选择。
- 选择扩展。
- 选择 WindowsAgent.SqlServer 或 LinuxAgent.SqlServer 以显示详细信息。
- 查看状态消息和
uploadStatus
值。 如果不是 OK,则连接到 DPS 时出现问题。 如果是 0,则可能存在防火墙阻止与 DPS 终结点的通信。 状态消息或uploadStatus
错误代码中可能有其他详细信息,可提供连接问题的见解。
检查 SQL Server 的 Azure 扩展日志
扩展日志文件位于:
C:\ProgramData\GuestConfig\extension_logs\Microsoft.AzureData.WindowsAgent.SqlServer\
日志文件名称取决于 SQL Server 的 Azure 扩展版本。 对于最新版本的 SQL Server 的 Azure 扩展,日志文件为:
unifiedagent.log
版本 1.1.24724.69
和更早版本扩展的日志文件为:
ExtensionLog_0.log
检查日志条目,这些条目可指示连接到 DPS 或遥测终结点时是否出现问题。
探测 Web 服务器终结点
可以使用各种工具探测 Web 服务器终结点的 DPS 和遥测。 例如,Invoke-WebRequest
或 curl
。
下面的示例使用 Invoke-Webrequest
:
Invoke-WebRequest telemetry.<region>.arcdataservices.com
可能的响应状态代码为:
Invoke-WebRequest: Response status code does not indicate success: 401 (Unauthorized).
预期为 401,因为遥测终结点上不存在未经身份验证的路由。
对于 DPS:
Invoke-WebRequest dataprocessingservice.<region>.arcdataservices.com
对于美国政府弗吉尼亚州,将 arcdataservices.com
替换为 arcdataservices.azure.us
。 此示例为:
Invoke-WebRequest dataprocessingservice.<region>.arcdataservices.azure.us
可能的响应状态代码为:
StatusCode : 200
StatusDescription : OK
预计 200,因为存在未经身份验证的路由。
探测到所有区域的连接
可以使用 test-connectivity.ps1 PowerShell 脚本探测到所有区域的连接。
注意
对于美国政府弗吉尼亚地区,替换为 arcdataservices.com
arcdataservices.azure.us
。
#This script repeatedly probes all regions for connectivity to the Azure Arc data services/Arc-enabled SQL Server endpoints for telemetry and the data processing service.
#The script will output the status of the connectivity to the console.
#The script will run indefinitely until stopped by the user.
#The script will iterate through all regions in the $regions array.
#The list of regions are updated as of June 7,2024 to reflect all publicly available, supported Azure regions for Arc-enabled SQL Server.
$regions = @(
"East US",
"East US 2",
"West US 2",
"West US 3",
"Central US",
"North Central US",
"South Central US",
"West Central US",
"Canada Central",
"Canada East",
"UK South",
"UK West",
"France Central",
"West Europe",
"North Europe",
"Switzerland North",
"Central India",
"Brazil South",
"South Africa North",
"UAE North",
"Japan East",
"Korea Central",
"Southeast Asia",
"Australia East",
"Sweden Central",
"Norway East"
)
$regions = $regions | ForEach-Object { $_.Replace(" ", "") }
do{
$regions | ForEach-Object {
$dps_url = "dataprocessingservice.$_.arcdataservices.com"
$ti_url = "telemetry.$_.arcdataservices.com"
try{
$dps_response_time = Measure-Command { $response = Invoke-WebRequest -Uri $dps_url -Method Get }
$dps_result = ($response).StatusCode
}catch{
$dps_result = $_.Exception.Message
}
try{
$ti_response_time = Measure-Command { $response = Invoke-WebRequest -Uri $ti_url -Method Get -SkipHttpErrorCheck }
}catch{
if($_.Exception.Message -like "*401*"){
$ti_result = "Expected"
}
else {
$ti_result = $_.Exception.Message
}
}
if ($ti_response_time.TotalSeconds -gt 3 -or $dps_response_time.TotalSeconds -gt 3 -or $dps_result -ne 200 -or $ti_result -ne "Expected") {
Write-Host $dps_result "($dps_response_time) " $ti_result " ($ti_response_time) :: $_" -ForegroundColor Red
}
elseif ($ti_response_time.TotalSeconds -gt 1 -or $dps_response_time.TotalSeconds -gt 1) {
Write-Host $dps_result "($dps_response_time) " $ti_result " ($ti_response_time) :: $_" -ForegroundColor Yellow
}
else
{
Write-Host $dps_result "($dps_response_time) " $ti_result " ($ti_response_time) :: $_"
}
}
Write-Host "====================================================================="
} while($true)
检查 TLS 版本兼容性
数据处理服务终结点支持以下 TLS 版本:TLS 1.2 和 1.3。 不支持 Windows Server 2012 及更早版本。
对于遥测终结点,不支持 Windows Server 2012 R2 和更早版本。
如果使用的 TLS 版本不受支持,则可能在日志中看到错误
<date time>|ERROR|SqlServerExtension.Service|Request failed with exception 'System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
---> System.Security.Authentication.AuthenticationException: Authentication failed because the remote party sent a TLS alert: 'HandshakeFailure'.
---> System.ComponentModel.Win32Exception (0x80090326): The message received was unexpected or badly formatted.
终结点引用
若要连接到 Azure,终结点使用 *.arcdataservices.com
。
其他背景
从 2024 年 3 月 12 日开始,SQL Server 的 Azure 扩展使用以下终结点:
- DPS:
dataprocessingservice.<region>.arcdataservices.com
,或在美国政府弗吉尼亚地区使用*.<region>.arcdataservices.azure.us
。 - 遥测
telemetry.<region>.arcdataservices.com
将 <region>
替换为 Arc 计算机资源所在的 Azure 区域的短名称。 短名称派生自 Azure 区域名,不带空格且所有字母小写。
例如,如果 Arc 计算机资源位于美国东部 2,则区域的短名称为 eastus2
,遥测终结点为:
telemetry.eastus2.arcdataservices.com
如果扩展早于 2024 年 3 月 11 日,它可能会使用较旧的终结点。 更新您的扩展程序以使用当前终结点。
注意
*.arcdataservices.com
之前的终结点值可能会更改。
使用 HTTPS 代理服务器进行出站连接
如果网络需要使用 HTTPS 代理服务器进行出站连接,可以阅读更新或删除代理设置中配置的相关详细信息。
查询 Azure Resource Graph 以获取遥测数据上传统计信息
使用 Azure Resource Graph 查询环境的上传状态。
resources
| where type =~ 'microsoft.hybridcompute/machines/extensions'
| where properties.type in ('WindowsAgent.SqlServer','LinuxAgent.SqlServer')
| parse id with * '/providers/Microsoft.HybridCompute/machines/' machineName '/extensions/' *
| parse properties with * 'uploadStatus : ' uploadStatus ';' *
| project uploadStatus, subscriptionId, resourceGroup, machineName
| where uploadStatus !in ('OK') //comment this out to see all upload stats
| order by uploadStatus desc
查找长时间未连接到 DPS 的 SQL 扩展
查询 Azure Resource Graph 以查找最近未连接到 DPS 的扩展。
resources
| where type =~ 'microsoft.hybridcompute/machines/extensions'
| where properties.type in ('WindowsAgent.SqlServer','LinuxAgent.SqlServer')
| parse id with * '/providers/Microsoft.HybridCompute/machines/' machineName '/extensions/' *
| parse properties with * 'timestampUTC : ' timestampUTC ';' *
| project timestampUTC, subscriptionId, resourceGroup, machineName
| order by timestampUTC desc
错误代码
下表显示了一些常见的 DPS 上传状态值,以及可以排除故障的操作步骤。
DPS 上传状态值 | HTTP 错误代码 | 故障排除建议 |
---|---|---|
0 |
可能的原因:防火墙正在阻止数据传输到 DPS。 打开 DPS 的 DNS 端点防火墙(TCP,端口:443)。 | |
OK |
200 | 连接正常工作。 |
Bad request |
400 | 可能的原因:资源名称(SQL Server 实例或数据库名称)不符合 Azure 资源的命名约定。 例如,如果数据库名称为保留字。 |
Unauthorized |
401 | 可能的原因:扩展已配置为通过需要身份验证的 HTTP 代理发送数据。 目前不支持使用需要身份验证的 HTTP 代理。 使用不经身份验证的 HTTP 代理或无代理。 |
Forbidden |
403 | 检查确保订阅上已注册Microsoft.AzureArcData 资源提供程序。 如果 Azure Connected Machine agent 在其他方面正常工作,并且此错误在重新启动后无法自行解决,请通过 Azure 门户创建支持案例与 Microsoft 支持联系。 |
NotFound |
404 | 扩展正在尝试连接的终结点不存在。 如需检查它尝试连接的终结点,请在日志中搜索 dataprocessingservice 。 如果 Azure Connected Machine agent 已部署并连接到 Microsoft.AzureArcData 资源提供程序尚不可用的 Azure 区域,则可能会发生这种情况。 在通过启用 Azure Arc 使 SQL Server 资源提供程序可用的区域Microsoft.AzureArcData 。 另请参阅区域可用性。可能没有为你的计算机刷新 DNS 解析程序缓存。 要自动刷新: - 在 Windows 上运行: ipconfig /flushdns - 在 Linux 上(如果使用 systemd )运行:sudo resolvectl flush-caches |
Conflict |
409 | 可能的原因:DPS 内部发生临时错误。 如果这无法自行解决,请通过 Azure 门户与 Microsoft 支持创建支持案例。 |
InternalServerError |
500 | 这是 DPS 内部发生的错误。 请通过 Azure 门户创建支持案例与 Microsoft 支持联系。 |