# About Me 葉柏毅 Alex Contact: alrex5401@gmail.com Linkedin:https://www.linkedin.com/in/alrex5401/ # VCP 考試重點整理 by 2017年 2V0-620考試or 2V0-602考試,線上考試:線上考試、無監考 2V0-621考試,考試中心,被監考 滿分500,及格300分,100分最低。 1. Server Consolidation:多台整併於一台主機 2. 避免服務合併:避免多服務互相影響 3. 備份容易:檔案類型 4. 移轉容易 5. 擺脫硬體限制 6. 測試容易 Virtualization 虛擬化:Physical Resource Sharing Emulation 模擬化:無中生有,經過轉換,以另一種形式呈現(慢) Types Of Virtualization 1. Server Virtualization 2. Desktop Virtualization(VDI) 1. Session:Remote Desktop Services(Terminal Services) 2. VM: 1. Citrix XenDesktop:功能多 2. VMware Horizon:效能好 3. Storage Virtualization: 1. 單一進入點 2. Mirror 3. Replication 4. 高Cache 5. Virtual SAN 6. Virtual Volume 4. Network Virtualization(SDN): 1. VMWARE NSX 2. 軟體中心 3. Router、Switch、VPN... 4. VXLAN:Layer 2 over Layer3 SDDC - 2008年 - VMworld - 軟體為中心 - 自動化:Policy-Based Management and Automation Cloud Computing 透過網路,提供服務 File System -VMFS:1 VMFS / Lun or Disk Encapsulation:避免用中文或雙位元語系命名。 ## vSphere Clients vSphere Clients: 1. 本機 1. DCUI 2. ESXi Shell 2. 遠端文字介面操作 1. Putty:ssh 2. vCLI(*.pl) 3. vMA 4. PowerCLI 3. 遠端圖形介面操作 1. vSphere Client(C#) 2. Browser(FLASH):https://________/vsphere-client(功能較齊全) 3. Browser(HTML5):https://________/ui https://labs.vmware.com/flings/esxi-embedded-host-client 1. Enable SSH 2. WinSCP:upload *vib 3. Putty:esxcli software vib install -v *vib 付費: ESXi: - 1 VC + 3 Esxi(2CPUs/Host) - Essentials - Essentials Plus - 依CPU Socket計費 - Standard - Enterprise - Enterprise Plus WS2016 ( 2CPUs*8Cores)/License) - Standard,約3萬 - 2 Guest OS Licenses (適用Esxi) - Datacenter,約12萬(超過七台Guest時,就划算) - Unlimited Guest OS Licenses 免費:vSphere Hypervisor。不能被VC管理。 VMM:Virtual Machine Monitor (VM Memory Overhead) Lockdown Mode - Nornal:不允許Root遠端登入 Lockdown Mode - Strict:僅允許VC管理 NTP架構:官方建議,不使用VMWARE Tools Sync Time ## VC模組 VC模組: 1. PSC:Platform Services Controller 1. –VMware vCenter® Single Sign-On 2. –VMware License Server 3. –Lookup Service 4. –VMware Certificate Authority 5. –Certificate Store 6. –VMware Directory Services 2. VC:vCenter Server 1. •vCenter Server 2. •vSphere Web Client (server) 3. •vSphere Update ManagerController 4. •VMware vSphere® Auto Deploy 5. •VMware vSphere® ESXiTM Dump Collector 6. •VMware vSphere® Syslog Collector ## VC版本 VC版本 ≥ ESXi版本 VC版本 Windows 1. OS另購 2. 手動安裝 3. 內建DB 1. 20 Hosts 2. 200 VMs 4. 外部DB 1. 2000 Hosts 2. 35000 VMs 3. SQL Server / Oracle Appliance 1. OS免費 2. 匯入即可 3. 內建DB 1. 2000 Hosts 2. 35000 VMs 4. 外部DB 1. 2000 Hosts 2. 35000 VMs 3. Oracle VC Service預設管理員帳號為administrator@vsphere.local VC OS預設管理員帳號為root VC Management UI:https://VC:5480。管理VC服務與備份 ![](https://hackmd.io/_uploads/HyHw57SNn.jpg) ESXi and vCenter Server Communication 1. 第一次連線,使用root帳號 2. 啟用vpxuser帳號,並設密碼 3. 之後,皆使用vpxuser ![](https://hackmd.io/_uploads/ByZO9XS43.jpg) 實務上,建議使用VMware Paravirtual SCSI,可達到效能提升。 https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1010398 ## Disk * Disk Type * Thick:存取快,適用於資料異動量變化快 * Eagerly:建立時填零。 * Iarily:針對第一次使用的部分填零。 * Thin:省空間,適用於資料異動量不大 * Disk Mode * Dependent,允許快照。(預設) * Independent,不要快照。 * Persistent,直接寫入。 * Non-Persistent,還原卡。 ## Virtual NetWork * Virtual NetWork * Flexible: * 32bit CuestOS * 使用GuestOS的Driver * AMD PCnet網卡(模擬) * 安裝VMware Tools後,自動變成VMXNET * E1000 * 64bit GuestOS * 使用GuestOS的Drvier * Intel E1000網卡(模擬) * 安裝VMware Tools後,自動變成VMXNET * VMXNET * 虛擬 * VMXNET2 * 虛擬 * 支援offload(網卡上具有處理能力) * VMXNET3(官方建議) * 虛擬 * 全功能 * SR-IOV:VM直接接在主機上實體網卡。1:N。該VM不能使用vMotion(Hyper-V可以vMotion)。 * DirectPath I/O:VM直接接在主機上實體網卡。1:1。該VM不能使用vMotion(Hyper-V可以vMotion)。 ## Virtual Appliance * Virtual Appliance格式 * OVF * *.ovf * *.vmdk * *-flat.vmdk * OVA * *.ova AWS:Stateless。無狀態,不希望運算時儲存任何資料。(關機後資料會消失) Azure:Stateful。類似傳統的Infra。 Photon = Linux + Docker Engine Docker = OS Version Linux - Docker - Image - Container WS2016 - Docker - ServerCore / NanoServer - Container ## 權限 DataCenter,識別與權限管理使用 Folder,純粹識別用 Tag,方便搜尋使用 * Permissions 權限 * Wirte * Read * Privileges 特權(職掌) * 每一個Privileges,互不相關 Role-Based Access Controls (RBAC) User -> Role - Privileges -> Objects 新增管理者 1. Home 2. Roles 3. 新增角色Role,並賦予Privileges 4. 針對Object(VC、Host、VM)之Permissions 5. 新增使用者,並指定Role * 權限互斥性: * 子物件權限高於父物件權限 * 兩個權限同時擁有,相加(取聯集) * 使用者權限,大於群組權限 ## VMKernel Port(VMKernel Adapter) || | --- | VMKernel || VMKernel Port || Virtual Switch || uplink port || Physical NIC * VMKernel Port * Management * FT * vMotion * vSphere Replication * vSAN * Storage * Port Group * 同一Port Group內,VM會互通 * 不同Port Group之間,VM不會通,需透過外部Switch * 將Port Group視為Switch * Virtual Switch視為一個管理的範圍 * 2n-8 port = 8~4088 * Virtual Switch,沒有Collision Detection * 不支援Spanning Tree * 若有多個uplink,會自動啟用NIC Teaming * 無uplink的vSwitch,稱作Internal only Switch * 當Port Group與vSwitch設定衝突時,以Port Group設定為主 ![](https://hackmd.io/_uploads/HJoG2mBE3.jpg) - 彈性 - 省資源 - 官方建議 ![](https://hackmd.io/_uploads/HkBQh7HEh.jpg) - 設定簡單 * vSS - Virtual Standard Switch * vDS - Virtual Distributed Switch * 需Esxi Enterprise Plus版本 * Configuring Security Policies * Promiscuous Mode:雜亂模式,將Switch降級成HUB * 是否需允修改卡號 * 可能使用時機:P2V、Windows NLB * 預設允許 * MAC address changes * Forged transmits ![](https://hackmd.io/_uploads/B1nH3mBN3.jpg) ![](https://hackmd.io/_uploads/Syz837B4h.jpg) Peak bandwidth最大頻寬 Average bandwidth:當超過傳輸上限時, Burst size:傳輸上限 Load balancing policy ![](https://hackmd.io/_uploads/H1DY2mrNn.jpg) ![](https://hackmd.io/_uploads/rJN53XSVn.jpg) ![](https://hackmd.io/_uploads/H1_93QBVn.jpg) ## Datastore * Datastore = Volume * Win = C: or D: <- Volume * Esxi = 1 vmfs /LUN or Disk * Type of Datastores * VMFS * NFS * vSAN * vSphere Virtual Volumes DAS (Direct Attached Storage) = Local Disk DAS on vMotion: Only Share Nothing vMotion(Enhanced vMotion) * Storage * HDDs * RAID * LUN * ESXi:LUN * Win:Disk vSAN:5.5 vSphere Virtual Volumes:6.0 ![](https://hackmd.io/_uploads/r1GCn7B42.jpg) * vSAN * Esxi 5.5開始支援 * 內建功能 * 另購License * 將Cluster中每一台Esxi的空硬碟共享出來 vSphere Virtual Volumes * Raw Device Mapping(RDM) * ESXi:Virtual Disk效能 > RDM * HyperV:Virtual Disk效能 < Passthrough Disk(RDM) * 使用情境一:臨時需求,將實體硬碟資料讀出。 * 使用情境二Failover Cluster:SQL Server(Esxi) -RDM-> Shared Storage <—SQL Server(實體機) * 不可掛載VMDS格式。 DB設計:一台ESXi上,只跑一台VM。更換實體機(效能),不需重新測試。 * FC * 1Gbps * 2Gbps * 4Gbps * 8Gbps * 16Gbps * 32Gbps * FCoE * 約86% 10Gbps * SAN Switch * LUN Masking (Server和Storage上設定) * From WWN1 To WWN2 LUN2 * Zoning(SAN Switch) * Form WWN1 To WWN2 * Multipathing * 兩台SAN Switch不能串起來(Inter-link) ![](https://hackmd.io/_uploads/HkOwa7BV3.jpg) * FCoE * 主要是節省主機插槽數,沒有比較快或是便宜 * 不可以用NIC Teaming * CNA,Converged Network Adapter,在NIC上有CPU處理器 * NIC With FCoE Support,支援FCoE協定的Protocol ![](https://hackmd.io/_uploads/B1r_a7HVn.jpg) iSCSI iSCSI iqn name: iqn.1998-01.com.vmware:train1-64ad4c29 iSCSI alias: train1 IP address: 192.168.36.88 * Static * IQN * IP * Dynamic * IP * iSCSI不支援NIC Teaming ![](https://hackmd.io/_uploads/rJYjpXBVn.jpg) * Runtime name(LUN的表達路徑): * vmhba N : C : T : L * 介面名 : Channel Port: Storage Phocessor : LUN * vmnba0:C1:t1:l1 * Datastores * 爆掉原因: 1. Thin-Provisioned Virtual Disk 2. VM開機時,產生*.vswp 3. 建立快照 * 現象: 1. Freeze * 解法: 1. 擴充Lun空間 1. 將多個Lun,組成一個VMFS 2. 將原本的Lun擴充 2. Storage vMotion * Multipathing Algorithms * Fixed * Path1 up * Path1 down -Failover-> Path2 up * Path1 up <-Failback- Path2 up * MRU (Most Recently Used) * Path1 up * Path1 down -Failover-> Path2 up * Path1 up <-Failback- Path2 dwon * RR (Round Robin) * Path1 * Path2 * Path1 * Path2 …… * 安裝第三方 * 上傳*zip * ssh->Esxi,esxcli software vib install -d "*.zip” ![](https://hackmd.io/_uploads/Hkh-AXr4n.jpg) ![](https://hackmd.io/_uploads/H1zGCmBVh.jpg) * NFS v3 locking is not compatible with NFS v4.1: * NFS v3 uses proprietary client-side cooperative locking. NFS v4.1 uses server- side locking. ![](https://hackmd.io/_uploads/SynzCmSEh.jpg) ![](https://hackmd.io/_uploads/BJ_ER7HEh.jpg) ![](https://hackmd.io/_uploads/SyAEAmSNh.jpg) * vSAN,主要解決VDI的大量IO需求。 * SSD空間,需要佔有10% * 網卡需要10G NIC * 主機至少要2N+1 * 1 SSD + 1-7 HDDs / Disk Group * 5 Disk Group / Host * Template * 不能開機的VM * VM * *.vmx * *.vmdk * *-flat.vmdx * *.vswp * *.log * Templat * *vmtx * *.vmdk * *-flat.vmdx * Customizing the Guest Operating System * 方法一: 1. VM(App+OS) 2. 建立Answer File 3. 執行Sysprep.exe 1. 刪除Computer Name 2. SID 3. User Profile 4. 關機 5. Template 6. 部屬VM * 方法二: 1. VM(App+OS) 2. 關機 3. Template 4. Customization Specification Manager 5. 產生Answer File 6. 部屬VM 7. 放入Answer File 8. 執行Sysprep 9. 完成 * Content Library * 單向複製 * RDM * Target LUN,不支援VMFS * Compatibility Mode * Physical * 64TB * Virtual * 62TB * 視為Virtual Disk,支援快照 Thin-provisioned virtual disks converted to a thick, eager-zeroed format. ![](https://hackmd.io/_uploads/rkLaAXrEh.jpg) ![](https://hackmd.io/_uploads/HJC60mS4n.jpg) ## vMotion * vSphere vMotion * 移動State * Config * Memory * CPU state CPU Scheduling Affinity,強制VM使用特定CPU Scoke EVC,新舊的CPU,VM要啟用EVC,EVC可以去比對CPU,並限制某種CPU才能移過去。主要限制「目標只能用什麼CPU類型」和相容。 * vSphere Storage vMotion * VAAI * Esxi 5.x * L2, < 150ms * Esxi 6.x * L2/L3,<250ms ![](https://hackmd.io/_uploads/r1JbyNHNn.jpg) ![](https://hackmd.io/_uploads/HkSWk4r43.jpg) ![](https://hackmd.io/_uploads/SJ2-kNBEh.jpg) vMotion步驟: 1. 建立Shared Storage 1. FC/iSCSI,於一台Esxi新增後,第二台會自動新增。 2. NFS,必須每一台Esxi作設定。 2. 兩台Esxi必須有VM所接的ProtGroup名稱(區分大小寫) 3. 指定VMKernel Prot傳輸vMotion資料 1. Esxi -> Confugure -> VMKernel Adapters -> 修改 or 新增 -> 勾選vMotion 4. 將VM檔案存到Shared Storage 1. VM,右鍵 2. Migrate 3. 選取Change Storage only 5. 將VM移轉到其他Esxi 1. VM,右鍵 2. Migrate 3. 選取Change Compute Resource only * 快照Snapshot * 32 Snapshots/VM * 製作/還原 ≤ 1min * 快照與備份無關 * 佔空間,存取慢 * VM * *.vmx * *.vmdk * *.flat.vmdk * *.vmsd 快照清單 * *.vmsn 設定 * *.vmem 記憶體 * *.delta.vmdk 差異 * *.vswp = Configured Memory - Reservation (default = 0) 當主機記憶體快要不夠用時 1. TPS:會將Esxi上將相同記憶體部分共用 ![](https://hackmd.io/_uploads/B1Slf4B42.jpg) 2. Ballooning:利用VMware Tools裡的Balloon Driver 1. VM1有記憶體需求 2. 向Esxi請求 3. 向該Esxi上的各Guest VM,利用VMware Tools裡的Balloon Driver先佔住記憶體空間 4. 回報Esxi該處有記憶體空間可用 5. 讓VM1利用該記憶體空間 ![](https://hackmd.io/_uploads/Sk1mGNr43.jpg) 3. Memory Compression 4. Host Swap * 工作管理員RAM資源 * Consumed :ESXi要來的 * Active:VM在用的 * LCPU(Logical Processor)= Socket數 * Core數 * HT(2) * eq: 4顆8核心CPU,HT Enabled * 4*8*2=64 * 亂加CPU的疑慮 * License * 資源浪費 * vCPU是否現閒置,平均2-40ms會自動偵測,並作資源平衡 ![](https://hackmd.io/_uploads/r1_HGVHN2.jpg) Reservation type :是否允許向上層Resource Pools要求資源。 * vApp * 限制CPU & Memory * 一群VM的總開關 * 控制VM的開關機順序 Esxi 開機設定 ![](https://hackmd.io/_uploads/Sk1YM4HN3.jpg) CPU效能不佳 1. 使用率高 -> 加CPU 2. 設定了Limit 3. Ready Time太高 -> vCPU等候可用的LCPU所需的時間 > 2000ms or 10%(or vCPU用太多) 1. Hyper-V,vCPU總數:LCPU總數 = 1:1 ~ 2:1 2. Esxi,vCPU總數:LCPU總數 = 1:1 ~ 5:1,VDI,7:1 RAM之Ballooning發生狀況 ![](https://hackmd.io/_uploads/BkN5MESN3.jpg) Host SWAP ≠ 0,表示主機效能不佳 * Disk Latency * \> 2~3 ms,表示VMKernel有點忙 * \> 15 ms,裝置可能有問題 * \> 20 ms,裝置有問題 * Network-intensive applications often bottleneck on path segments outside the ESXi host: * Example: WAN links between server and client * If you suspect that a virtual machine is constrained by the network: * Verify that VMware Tools is installed. * Enhanced network drivers are available. * Measure the effective bandwidth between the virtual machine and its peer system. * Check for dropped receive packets( ≠ 0,表示Guest OS太忙) and dropped transmit packets.( ≠ 0,表示uplink頻寬不足) ![](https://hackmd.io/_uploads/BkhAfEBN3.jpg) Third-Party Backup Solution 建議,要支援VADP,而非Agent 因Agent類似後門程式,不一定可信任,且升級可能有問題。 ## vCenter Server Availability * vCenter Server Availability 1. vCenter Server database SQL cluster 2. 將VC放置在ESXi HA Cluster 3. VC Appliance,安裝時選Three-Node HA 1. 備份,https://VC:5480,點選備份 2. 還原,執行安裝光碟,點選還原 4. VC Win,參考VC Availability Guide,附錄A 1. 備份,需備份DB、SSL、vpxd.cfg 2. 還原,重製VC,在複製備份檔 * vSphere HA Scenario: Application Failure * 需額外安裝App HA,才能進行偵測。 * 支援清單: ![](https://hackmd.io/_uploads/B15GQ4HVh.jpg) * ESXi之間的Heartbeat network * 預設使用 VMkernel port for management 當Heartbeat network * 如果有多個VMKernel,則必須每一條都斷,才會判定斷線。 * 如果有啟用vSAN,則改用vSAN network 當作Heartbeat network HA架構 ![](https://hackmd.io/_uploads/rJn4XNrEn.jpg) 判斷方式: 1. 先偵測Network Heartbeats是否存在 2. 再判斷Datastore Heartbeats是否正常(偵測ESXi Touch的檔案日期是否變動) MOID: 數字大,權位高 ![](https://hackmd.io/_uploads/SkXL74S42.jpg) Virtual Machine Component Protection - VMCP ![](https://hackmd.io/_uploads/SyjImVH42.jpg) HA設定 ![](https://hackmd.io/_uploads/By-wmNSE3.jpg) ![](https://hackmd.io/_uploads/r1Pv7VHEh.jpg) ## HA策略 * HA策略: 1.Slot,假設每一台VM使用資源都一樣。較適用於VDI | | VM1 | VM2 | VM3 | | -------- | -------- | -------- | -------- | | CPU | 512MHz | 400MHz | 300MHz | | RAM | 400MB |512MB | 512MB | * Slot Size:CPU 512MHz,RAM 512MB * 假設每台Esxi資源 CPU 1GMHz, RAM 1GB * 故每台可容納兩台VM資源作評估。 2.Resoure Percentage,適用大部分狀況。 * 允許停機主機數 / 主機總數 * 例如: 1/3 = 33% * 故每一台主機會保留33%資源 3.Dedicated * 將一台Esxi資源完全保留。 萬一公司環境,Esxi主機上Network Heartbeat不能以Default Gateway作為判斷依據時 ![](https://hackmd.io/_uploads/H1P8V4HVn.jpg) * FT * 透過網路複寫,建議10Gbps * 若網路頻寬不足,會將來源端VM之CPU降速 * FT不支援Nested Virtualization(虛擬機中的ESXi) * 最多一台Esxi只能開啟4台VM * ESXi 5.x 1. 僅支援 1vCPU 2. 僅作state複寫 * ESXI 6.x 1. 支援 4vCPU 2. 支援state與files複寫 3. Secondary VM不做運算,CPU使用率低 * Virtual Machine Affinity * 調整VM之間開機的相依性 * DRS Groups * 將VM與Hosts群組化 * VM-Host Affinity Rules * 牴觸情況下,可用性(分開)大於效能(一起) ![](https://hackmd.io/_uploads/S11sSVB4h.jpg) ![](https://hackmd.io/_uploads/r1RjHEBN2.jpg) ## Maintenance Mode Maintenance Mode 1. 禁止VM移入 2. 禁止啟動未開機的VM 3. 將VM移出 Standby Mode 1. DRS:開啟Power Mgt(DPM) 2. 主機關機,但可被喚醒:iLo、Wake-on LAN ## vSphere Update Manager vSphere Update Manager 集中管理: 1. automated patch 2. version management for ESXi hosts, 3. virtual machine hardware, 4. VMware Tools, 5. virtual appliances. * vSphere Update Manager : * Automated patch downloading: * Automated path downloading begins with information-only downloading. * It is scheduled at regular configurable intervals. * Creation of baselines and baseline groups * Ability to attach baselines and baseline groups to inventory objects建立條件 * Scanning: 比對 * Inventory systems are scanned for baseline compliance. * Remediation: 安裝 * Inventory systems that are not compliant can be automatically patched. * Patch Recall Notification * Recall僅不再繼續安裝更新,但已經安裝玩的path不自動移除 * vSphere Update Manager does not uninstall recalled patches from ESXi hosts. * 移除指令: * esxcli:software vib list * esxcli:software vib remove —vibname=vib套件名稱 |ESXi:http://Esxi/ui | |--------| |VC| |ShareStore<BR>-iSCSI<BR>-NFS<BR>-FC| |vMotion| |Cluster<BR>-iHA<BR>-iFT<BR>-iDRS<BR>-ivSAN| ## 指令工具 * Command Line Tools * DCUI [Alt+F2] * ESXi Shell [Alt+F1] * SSH * vCLI (vSphere Management Application - vMA) * PowerCLI (for VC) * vCLI常用指令 * esxcli * esxcli Namespaces command option * esxcli fcoe * esxcli hardware * esxcli iscsi * esxcli license * esxcli network * esxcli software * esxcli storage * esxcli system * esxcli vm * esxcli esxcli command list for a full listing * resxtop * svmotion * vicfg-commands * vifs * vmkfstools * vmware-cmd ## 升級順序 升級順序: 1. PSC 2. VC 3. ESXi 4. VMFS 5. VM