다음을 통해 공유


수평적 컴퓨터 계층 (스크립트)

 

적용 대상: System Center 2012 R2 Virtual Machine Manager, System Center 2012 - Virtual Machine Manager

서비스를 배포한 후 VMM, 컴퓨터 계층에 가상 컴퓨터를 추가 하 여 서비스를 확장할 수 있습니다. 설정 하 여으로 컴퓨터 계층을 확장할 수 있는지 여부를 정의 하는 InstanceMaximumCount 컴퓨터 계층 템플릿에 대 한 매개 변수입니다.

고 지 사항

다음 스크립트는 가상 컴퓨터를 추가 계층에 대 한 최대 컴퓨터 개수를 초과 하지는 여는 계층을 확장할 수 있는지 여부를 확인 합니다. 스크립트는 다음 컴퓨터 계층에 가상 컴퓨터를 추가 하 여 서비스를 조정 합니다.

  
# Description:      This script scales out a service by adding a virtual machine  
#                   to a computer tier.  
  
# Get the service and the computer tier.  
$Service = Get-SCService -Name "Service01"  
$Tier = Get-SCComputerTier -Service $Service | where {$_.Name -eq "Web Tier"}  
  
# Ensure that you are able to scale out the tier.  
If ($Tier.VMs.count -eq $Tier.InstanceMaximumCount) {throw "You have reached the instance maximum for this tier."}  
  
# Create a virtual machine configuration for the computer tier.  
$VMConfig = New-SCVMConfiguration -ComputerTier $Tier -Name "NewServiceVM01" -Description "New virtual machine configuration for tier"  
  
# Get the best host on which to deploy the virtual machine.  
$VMHosts = Get-SCVMHost  
$HostRatings = @(Get-SCVMHostRating -VMHost $VMHosts -VMConfiguration $VMConfig | where {$_.Rating -gt 0} | sort -Property Rating -Descending)  
If ($HostRating.Count -eq 0) {throw "No hosts meet the placement requirements."}  
$VMHost = $HostRatings[0].vmhost  
  
# Set the host on the virtual machine configuration.  
Set-SCVMConfiguration -VMConfiguration $VMConfig -VMHost $VMHost  
Update-SCVMConfiguration -VMConfiguration $VMConfig  
  
# Create a virtual machine for the service.  
$VM = New-SCVirtualMachine -Name "NewServiceVM01" -VMConfigurationScaleOut $VMConfig  
  

참고 항목

컴퓨터 계층 (스크립트)의 크기 조정