对 Azure 文件进行故障排除

总结

本文列出了与 Azure 文件存储相关的常见问题,包括连接性、DNS 解析和访问错误。 它提供了可能的原因和解决方法来帮助快速解决 Azure 文件共享问题。

注意

本文有帮助吗? 你的输入对我们很重要。 请使用此页上的 “反馈 ”按钮告诉我们本文为你工作得有多好,或者我们如何改进它。

如果你未能找到问题的答案,请通过以下渠道联系我们(以升序排列):

适用于

文件共享类型 SMB NFS
标准文件共享 (GPv2)、LRS/ZRS
标准文件共享 (GPv2)、GRS/GZRS
高级文件共享 (FileStorage)、LRS/ZRS

常规故障排除步骤

如果遇到Azure 文件存储问题,请从以下步骤开始。

检查 DNS 解析以及与 Azure 文件共享的连接

Azure 文件存储客户遇到的最常见问题是由于网络配置不正确而导致装载或访问 Azure 文件共享失败。 Azure 文件存储支持的三种文件共享协议中的任何一种都可能出现此问题:SMB、NFS 和 FileREST。

下表提供了 SMB、NFS 和 FileREST 可以使用的存储帐户的网络终结点要求,以及可以通过哪个端口访问该终结点。 若要详细了解网络终结点,请参阅 Azure 文件存储网络注意事项

协议名称 非受限公共终结点 受限公共终结点 专用终结点 所需的端口
SMB TCP 445
NFS TCP 2049
FileREST TCP 443 (HTTPS),TCP 80 (HTTP)

若要成功装载或访问文件共享,客户端必须:

  • 能够将存储帐户的完全限定域名(例如 mystorageaccount.file.core.windows.net)解析为存储帐户所需网络终结点的正确 IP 地址。

  • 在所需协议的正确端口上与正确解析的 IP 地址建立成功的 TCP 连接。

注意

装载或访问共享时,必须为存储帐户使用完全限定的域名(FQDN)。 以下命令可让你看到存储帐户的网络终结点的当前 IP 地址,但不应将这些 IP 地址硬编码为任何脚本、防火墙配置或其他位置。 不保证 IP 地址保持不变,并且可以随时更改。

检查 DNS 名称解析

使用以下命令可以测试存储帐户的 DNS 名称解析。

# If you have changed the DNS configuration in your environment, it may be helpful to clear
# the DNS client cache to ensure you're getting the updated DNS name resolution.
Clear-DnsClientCache

# Replace this value with the fully qualified domain name for your storage account. 
# Different storage accounts, especially in different Azure environments, 
# may have different suffixes than file.core.windows.net, so be sure to use the correct
# suffix for your storage account.
$hostName = "mystorageaccount.file.core.windows.net"

# Do the name resolution. Piping to Format-List is optional.
Resolve-DnsName -Name $hostName | Format-List

根据环境和所需的网络配置,返回的 Resolve-DnsName 输出可能有所不同。 例如,如果尝试访问未配置任何专用终结点的存储帐户的公共终结点,则会看到以下输出。 在此输出中, x.x.x.x 是 Azure 存储平台群集 file.phx10prdstf01a.store.core.windows.net 的 IP 地址,用于提供存储帐户。

Name       : mystorageaccount.file.core.windows.net
Type       : CNAME
TTL        : 27
Section    : Answer
NameHost   : file.phx10prdstf01a.store.core.windows.net

Name       : file.phx10prdstf01a.store.core.windows.net
QueryType  : A
TTL        : 60
Section    : Answer
IP4Address : x.x.x.x

如果尝试访问配置了一个或多个专用终结点的存储帐户的公共终结点,则会看到以下输出。 输出包含一个额外的 CNAME 记录,该记录 mystorageaccount.privatelink.file.core.windows.net位于存储帐户的常用 FQDN 和存储群集的名称之间。 此记录可在用户从 Internet 访问时对公共终结点的 IP 地址进行名称解析,当用户从Azure虚拟网络(或对等网络)内部访问时解析专用终结点的 IP 地址。

Name       : mystorageaccount.file.core.windows.net
Type       : CNAME
TTL        : 60
Section    : Answer
NameHost   : mystorageaccount.privatelink.file.core.windows.net

Name       : mystorageaccount.privatelink.file.core.windows.net
Type       : CNAME
TTL        : 60
Section    : Answer
NameHost   : file.phx10prdstf01a.store.core.windows.net


Name       : file.phx10prdstf01a.store.core.windows.net
QueryType  : A
TTL        : 60
Section    : Answer
IP4Address : x.x.x.x

如果将其解析到专用终结点,通常应会看到 mystorageaccount.privatelink.file.core.windows.net 的 A 记录映射到专用终结点的 IP 地址:

Name                   : mystorageaccount.file.core.windows.net
Type                   : CNAME
TTL                    : 53
Section                : Answer
NameHost               : mystorageaccount.privatelink.file.core.windows.net


Name                   : mystorageaccount.privatelink.file.core.windows.net
QueryType              : A
TTL                    : 10
Section                : Answer
IP4Address             : 10.0.0.5

检查 TCP 连接

使用以下命令可以测试客户端与解析的 IP 地址和端口号建立 TCP 连接的能力。

# Replace this value with the fully qualified domain name for your storage account. 
# Different storage accounts, especially in different Azure environments, 
# may have different suffixes than file.core.windows.net, so be sure to use the correct
# suffix for your storage account.
$hostName = "mystorageaccount.file.core.windows.net"

# Do the TCP connection test - see the above protocol/port table to figure out which
# port to use for your test. This test uses port 445, the port used by SMB.
Test-NetConnection -ComputerName $hostName -Port 445

如果连接已成功建立,则会看到以下结果:

ComputerName     : mystorageAccount.file.core.windows.net
RemoteAddress    : x.x.x.x
RemotePort       : 445
InterfaceAlias   : Ethernet
SourceAddress    : y.y.y.y
TcpTestSucceeded : True

运行诊断

Windows 客户端Linux 客户端都可以使用 AzFileDiagnostics 来确保客户端环境包含正确的必备组件。 AzFileDiagnostics 自动运行症状检测,并帮助你设置环境以获得最佳性能。

常见故障排除领域

有关更多详细信息,请选择要进行故障排除的主题区域。

某些问题可能与多个主题领域相关(例如,连接和性能)。

需要帮助?

如果仍需帮助,请联系支持人员,以快速解决问题。

另请参阅