RVC使用指南(六)-排错
https://mp.weixin.qq.com/s/C7ERFd_C72sWjgptZZpokw
看了就要关注我,哈哈~
本文是关于vSAN的故障排除命令。
-
vsan.obj_status_report
-
vsan.check_state
-
vsan.fix_renamed_vms
-
vsan.reapply_vsan_vmknic_config
-
vsan.vm_perf_stats
-
vsan.clear_disks_cache
-
vsan.lldpnetmap
-
vsan.recover_spbm
-
vsan.support_information
-
vsan.purge_inaccessible_vswp_objects
-
vsan.scrubber_info
vsan.obj_status_report [-t|-f|-u|-i] ~cluster|~host
提供有关对象及其健康状态的信息。使用此命令,可以知道所有对象组件是否正常,表示见证组件和所有镜像均可用并且已同步。它还标识可能被孤立的对象。
-
-t, --print-table: Print a table of object and their status, default all objects
-
-f, --filter-table: Filter the obj table based on status displayed in histogram, e.g. 2/3
-
-u, --print-uuids: In the table, print object UUIDs instead of vmdk and vm paths
-
-i, --ignore-node-uuid: Estimate the status of objects if all comps on a given host were healthy.
示例1-组件状态图:
我们可以看到45个具有3/3健康的对象和23个具有7/7健康的对象。使用默认策略,3/3是磁盘(2个副本+见证),而7/7是磁盘空间。在此示例中,我们还可以看到一个孤立对象。
> vsan.obj_status_report ~cluster Querying all VMs on vSAN ... Querying all objects in the system from vesx1.virten.lab ... Querying all disks in the system from vesx1.virten.lab ... Querying all components in the system from vesx1.virten.lab ... Querying all object versions in the system ... Got all the info, computing table ... Histogram of component health for non-orphaned objects +-------------------------------------+------------------------------+ | Num Healthy Comps / Total Num Comps | Num objects with such status | +-------------------------------------+------------------------------+ | 3/3 | 45 | | 7/7 | 23 | +-------------------------------------+------------------------------+ Total non-orphans: 68 Histogram of component health for possibly orphaned objects +-------------------------------------+------------------------------+ | Num Healthy Comps / Total Num Comps | Num objects with such status | +-------------------------------------+------------------------------+ | 1/3 | 1 | +-------------------------------------+------------------------------+ Total orphans: 1 Total v1 objects: 0 Total v2 objects: 0 Total v2.5 objects: 0 Total v3 objects: 0 Total v5 objects: 68
示例2-将包含所有对象及其状态的表添加到命令输出, 显示的是孤立的对象。
> vsan.obj_status_report ~cluster -t Querying all VMs on VSAN ... Querying all objects in the system from esx1.virten.lab ... Querying all disks in the system ... Querying all components in the system ... Got all the info, computing table ... Histogram of component health for non-orphaned objects +-------------------------------------+------------------------------+ | Num Healthy Comps / Total Num Comps | Num objects with such status | +-------------------------------------+------------------------------+ | 3/3 | 45 | | 7/7 | 23 | +-------------------------------------+------------------------------+ Total non-orphans: 68 Histogram of component health for possibly orphaned objects +-------------------------------------+------------------------------+ | Num Healthy Comps / Total Num Comps | Num objects with such status | +-------------------------------------+------------------------------+ | 1/3 | 1 | +-------------------------------------+------------------------------+ Total orphans: 1 +-----------------------------------------------------------------------------+---------+---------------------------+ | VM/Object | objects | num healthy / total comps | +-----------------------------------------------------------------------------+---------+---------------------------+ | perf9 | 1 | | | [vsanDatastore] 735ec152-da7c-64b1-ebfe-eca86bf99b3f/perf9.vmx | | 7/7 | | perf8 | 1 | | | [vsanDatastore] 195ec152-92a3-491b-801d-eca86bf99b3f/perf8.vmx | | 7/7 | [...] +-----------------------------------------------------------------------------+---------+---------------------------+ | Unassociated objects | | | [...] | 795dc152-6faa-9ae7-efe5-001b2193b9a4 | | 3/3 | | d068ab52-b882-c6e8-32ca-eca86bf99b3f | | 1/3* | | ce5dc152-c5f6-3efb-9a44-001b2193b3b0 | | 3/3 | +-----------------------------------------------------------------------------+---------+---------------------------+ +------------------------------------------------------------------+ | Legend: * = all unhealthy comps were deleted (disks present) | | - = some unhealthy comps deleted, some not or can't tell | | no symbol = We cannot conclude any comps were deleted | +------------------------------------------------------------------+
示例3-添加包含不正常组件的过滤表。过滤表显示1/3健康组件。
> vsan.obj_status_report ~cluster -t -f 1/3 [...] +-----------------------------------------+---------+---------------------------+ | VM/Object | objects | num healthy / total comps | +-----------------------------------------+---------+---------------------------+ | Unassociated objects | | | | d068ab52-b882-c6e8-32ca-eca86bf99b3f | | 1/3* | +-----------------------------------------+---------+---------------------------+ [...]
vsan.check_state [-r|-e|-f] ~cluster|~host
检查虚拟机和VSAN对象的状态。此命令还可以在对象不同步的情况下重新注册虚拟机。
-
-r, --refresh-state: Not just check state, but also refresh
-
-e, --reregister-vms: Not just check for vms with VC/hostd/vmx out of sync but also fix them by un-registering and re-registering them
-
-f, --force: Force to re-register vms, without confirmation
示例1-检查状态
> vsan.check_state ~cluster Step 1: Check for inaccessible vSAN objects Detected 0 objects to be inaccessible Step 2: Check for invalid/inaccessible VMs Step 3: Check for VMs for which VC/hostd/vmx are out of sync Did not find VMs for which VC/hostd/vmx are out of sync
vsan.fix_renamed_vms [-f] ~vm
在将虚拟机重命名为vmx文件路径时,此命令可重命名。某些VM可能被重命名为vmx文件路径,如 “ /vmfs/volumes/vsanDatastore/foo/foo.vmx”。此命令会将此VM重命名为“ foo”。
-f, --force: Force to fix name (No asking)
示例1-重命名VM
> vsan.fix_renamed_vms ~/vms/vmfs/volumes/vsanDatastore/vma.virten.lab/vma.virten.lab.vmx/ Continuing this command will rename the following VMs: /vmfs/volumes/vsanDatastore/vma.virten.lab/vma.virten.lab.vmx -> vma.virten.lab Do you want to continue [y/N]? y Renaming... Rename /vmfs/volumes/vsanDatastore/vma.virten.lab/vma.virten.lab.vmx: success
vsan.reapply_vsan_vmknic_config [-v|-d] ~host
解除绑定并将vSAN重新绑定到VMkernel端口。当VSAN群集中存在网络配置问题时(例如,vSAN检测到要分区的网络并且已修复网络配置时),此功能很有用。
-
-v, --vmknic: Refresh a specific vmknic. default is all vmknics
-
-d, --dry-run: Do a dry run: Show what changes would be made
示例1-运行以下命令
> vsan.reapply_vsan_vmknic_config -d ~esx Host: vesx1.virten.lab Would reapply config of vmknic vmk2: AgentGroupMulticastAddress: 224.2.3.4 AgentGroupMulticastPort: 23451 IPProtocol: IP InterfaceUUID: 8cbca458-2ccd-0606-125a-005056b968bd MasterGroupMulticastAddress: 224.1.2.3 MasterGroupMulticastPort: 12345 MulticastTTL: 5
示例1-将vSAN重新绑定到VMkernel端口:
> vsan.reapply_vsan_vmknic_config ~esx Host: vesx1.virten.lab Reapplying config of vmk2: AgentGroupMulticastAddress: 224.2.3.4 AgentGroupMulticastPort: 23451 IPProtocol: IP InterfaceUUID: 8cbca458-2ccd-0606-125a-005056b968bd MasterGroupMulticastAddress: 224.1.2.3 MasterGroupMulticastPort: 12345 MulticastTTL: 5 Unbinding vSAN from vmknic vmk2 ... Rebinding vSAN to vmknic vmk2 ...
vsan.vm_perf_stats [-i|-s] ~vm
显示虚拟机性能统计信息。
-
-i, --interval: Time interval to compute average over (default: 20)
-
-s, --show-objects: Show objects that are part of VM
支持以下指标:
-
IOPS (read/write)
-
Throughput? in KB/s (read/write
-
Latency in ms (read/write)
示例1-显示性能统计信息(默认值:20秒间隔):
> vsan.vm_perf_stats ~vm Querying info about VMs ... Querying VSAN objects used by the VMs ... Fetching stats counters once ... Sleeping for 20 seconds ... Fetching stats counters again to compute averages ... Got all data, computing table +-----------+--------------+------------------+--------------+ | VM/Object | IOPS | Tput (KB/s) | Latency (ms) | +-----------+--------------+------------------+--------------+ | win7 | 325.1r/80.6w | 20744.8r/5016.8w | 2.4r/12.2w | +-----------+--------------+------------------+--------------+
示例2-以5秒的间隔显示所有VM对象的性能统计信息:
> vsan.vm_perf_stats --show-objects --interval=5 ~vm Querying info about VMs ... Querying VSAN objects used by the VMs ... Fetching stats counters once ... Sleeping for 5 seconds ... Fetching stats counters again to compute averages ... Got all data, computing table +-----------------------------------------------------+-------------+----------------+--------------+ | VM/Object | IOPS | Tput (KB/s) | Latency (ms) | +-----------------------------------------------------+-------------+----------------+--------------+ | win7 | | | | | ddc4a952-c91c-a777-771f-001b2193b9a4/win7.vmx | 0.0r/0.3w | 0.0r/0.2w | 0.0r/26.1w | | ddc4a952-c91c-a777-771f-001b2193b9a4/win7.vmdk | 166.6r/3.9w | 10597.2r/13.2w | 5.2r/23.5w | | ddc4a952-c91c-a777-771f-001b2193b9a4/win7_1.vmdk | 0.0r/72.6w | 0.0r/4583.7w | 0.0r/13.1w | +-----------------------------------------------------+-------------+----------------+--------------+
vsan.clear_disks_cache
清除缓存的磁盘信息。$disksCache是一个内部变量。
示例1-清除磁盘缓存(没有输出)
> vsan.clear_disks_cache
vsan.lldpnetmap ~cluster|~host
通过使用链路层发现协议(LLDP)显示物理网络接口与物理交换机之间的映射。
示例1-显示所有主机的LLDP信息:
> vsan.lldpnetmap ~cluster This operation will take 30-60 seconds ... +-------------------+--------------+ | Host | LLDP info | +-------------------+--------------+ | esx2.virten.local | s320: vmnic1 | | esx3.virten.local | s320: vmnic1 | | esx1.virten.local | s320: vmnic1 | +-------------------+--------------+
vsan.support_information [-s] ~cluster
使用此命令收集集群信息
-s, --skip-hostvm-info: Skip collecting host and vm information in vSAN cluster
-
vsan.support_information
-
vsan.cluster_info
-
vsan.host_info
-
vsan.vm_object_info
-
vsan.host_info
-
vsan.vm_object_info
-
vsan.host_info
-
vsan.vm_object_info
-
vsan.disks_info
-
vsan.disks_stats
-
vsan.check_limits
-
vsan.check_state
-
vsan.lldpnetmap
-
vsan.obj_status_report
-
vsan.resync_dashboard
-
vsan.disk_object_info
示例1-收集支持信息:
> vsan.support_information ~cluster VMware virtual center af2287bd-1dff-42a2-812d-bbaa9777221e *** command> vsan.support_information vSAN65 *** command> vsan.cluster_info vSAN65 *** command> vsan.host_info vesx1.virten.lab *** command> vsan.vm_object_info *** command> vsan.host_info vesx3.virten.lab *** command> vsan.vm_object_info *** command> vsan.host_info vesx2.virten.lab *** command> vsan.vm_object_info *** command> vsan.disks_info *** command> vsan.disks_stats *** command> vsan.check_limits vSAN65 *** command> vsan.check_state vSAN65 *** command> vsan.lldpnetmap vSAN65 *** command> vsan.obj_status_report vSAN65 *** command> vsan.resync_dashboard vSAN65 *** command> vsan.disk_object_info vSAN65, disk_uuids Total time taken - 62.86973495 seconds
vsan.purge_inaccessible_vswp_objects [-f] ~cluster
搜索和删除vSAN群集上无法访问的vswp对象。
VM vswp文件用于内存交换,在vSAN中,vswp文件以vSAN对象的形式存在。当vswp对象变得不可访问时,将无法进行内存交换,并且当主机下次尝试为VM交换内存时,VM可能崩溃。
通过删除vswp对象,不会导致数据丢失。下次启动虚拟机时,将重新生成vswp对象。
-f, --force: Force to delete the inaccessible vswp objects quietly (no interactive confirmations)
> vsan.purge_inaccessible_vswp_objects ~cluster Collecting all inaccessible vSAN objects... Found 0 inaccessbile objects.
vsan.scrubber_info ~cluster
对于每个主机,该命令将列出每个VM及其磁盘,并显示与Virtual SAN后台任务(称为“Scrubbing”)相关的多个参数。
Scrubbing负责定期读取Virtual SAN上存储的每个对象的整个地址空间,以查找支持VSAN的物理磁盘上的潜在扇区错误。
请注意,这是Virtual SAN自动执行的后台任务。为了不影响生产工作负载,它运行非常缓慢。该命令旨在让你对该后台任务有所了解。
示例1-显示scrubber信息
> vsan.scrubber_info ~cluster +------+------------------+ | Host | vesx2.virten.lab | +------+------------------+ +-----------------------------------------------------------------+-------------------+-----------------+------------------+ | Obj Name | Total object Size | Errors detected | Errors recovered | +-----------------------------------------------------------------+-------------------+-----------------+------------------+ | VM: vMA | | | | | [vsanDatastore] b28df658-c089-2d82-5649-005056b9f17c/vMA.vmx | 510.0 GB | 0 | 0 | | [vsanDatastore] b28df658-c089-2d82-5649-005056b9f17c/vMA.vmdk | 6.0 GB | 0 | 0 | +-----------------------------------------------------------------+-------------------+-----------------+------------------+ +------+------------------+ | Host | vesx3.virten.lab | +------+------------------+ +--------------------------------------------------------------------+-------------------+-----------------+------------------+ | Obj Name | Total object Size | Errors detected | Errors recovered | +--------------------------------------------------------------------+-------------------+-----------------+------------------+ | VM: testvm | | | | | [vsanDatastore] da00a658-f668-f186-af1c-005056b9f17c/testvm.vmx | 510.0 GB | 0 | 0 | | [vsanDatastore] da00a658-f668-f186-af1c-005056b9f17c/testvm.vmdk | 12.0 GB | 0 | 0 | +--------------------------------------------------------------------+-------------------+-----------------+------------------+