SQL Server 2022가 사전 설치된 SQL Server 프리미엄 이미지를 사용합니다.
동률 처리 기능을 제공하고 장애 조치 시나리오에 사용되는 쿼럼을 확보하려면 파일 공유 감시 역할을 하는 세 번째 VM을 배포합니다.
- 기존 Cloud Shell 세션으로 돌아갑니다.
클러스터 노드의 특수 스크립트를 만듭니다. 이 스크립트는 필요한 Windows 기능을 설치하고 장애 조치 클러스터 및 SQL Server의 방화벽 규칙을 만듭니다.
cat << "EOF" > specialize-node.ps1 $ErrorActionPreference = "stop" # Install required Windows features Install-WindowsFeature Failover-Clustering -IncludeManagementTools Install-WindowsFeature RSAT-AD-PowerShell # Open firewall for availability group listener netsh advfirewall firewall add rule name="Allow SQL Server Listener health check" dir=in action=allow protocol=TCP localport=59997 # Open firewall for the Failover Cluster netsh advfirewall firewall add rule name="Allow SQL Server health check" dir=in action=allow protocol=TCP localport=59998 # Open firewall for SQL Server netsh advfirewall firewall add rule name="Allow SQL Server" dir=in action=allow protocol=TCP localport=1433 # Open firewall for SQL Server replication netsh advfirewall firewall add rule name="Allow SQL Server replication" dir=in action=allow protocol=TCP localport=5022 # Format data disk Get-Disk | Where partitionstyle -eq 'RAW' | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel 'Data' -Confirm:$false # Create data and log folders for SQL Server md d:\Data md d:\Logs EOF
VM 인스턴스를 만듭니다. 클러스터 노드로 작동하는 두 VM에서 메타데이터 키
enable-wsfc를true로 설정하여 추가 데이터 디스크를 연결하고 Windows Server 장애 조치 클러스터링을 사용 설정합니다.REGION=$(gcloud config get-value compute/region) ZONE1=$(gcloud config get-value compute/zone) ZONE2=$(gcloud config get-value compute/zone) ZONE3=$(gcloud config get-value compute/zone) PD_SIZE=200 MACHINE_TYPE=n2-standard-8 gcloud compute instances create node-1 \ --zone $ZONE1 \ --machine-type $MACHINE_TYPE \ --subnet $SUBNET_NAME \ --image-family sql-ent-2022-win-2022 \ --image-project windows-sql-cloud \ --tags wsfc,wsfc-node \ --boot-disk-size 50 \ --boot-disk-type pd-ssd \ --boot-disk-device-name "node-1" \ --create-disk=name=node-1-datadisk,size=$PD_SIZE,type=pd-ssd,auto-delete=no \ --metadata enable-wsfc=true \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-node.ps1 gcloud compute instances create node-2 \ --zone $ZONE2 \ --machine-type $MACHINE_TYPE \ --subnet $SUBNET_NAME \ --image-family sql-ent-2022-win-2022 \ --image-project windows-sql-cloud \ --tags wsfc,wsfc-node \ --boot-disk-size 50 \ --boot-disk-type pd-ssd \ --boot-disk-device-name "node-2" \ --create-disk=name=node-2-datadisk,size=$PD_SIZE,type=pd-ssd,auto-delete=no \ --metadata enable-wsfc=true \ --metadata-from-file=sysprep-specialize-script-ps1=specialize-node.ps1 gcloud compute instances create "witness" \ --zone $ZONE3 \ --machine-type n2-standard-2 \ --subnet $SUBNET_NAME \ --image-family=windows-2022 \ --image-project=windows-cloud \ --tags wsfc \ --boot-disk-size 50 \ --boot-disk-type pd-ssd \ --metadata sysprep-specialize-script-ps1="add-windowsfeature FS-FileServer"
VM 인스턴스 3개를 Active Directory에 조인하려면 VM 인스턴스 3개마다 다음을 수행합니다.
직렬 포트 출력을 확인하여 VM의 초기화 프로세스를 모니터링합니다.
gcloud compute instances tail-serial-port-output
NAMENAME을 VM 인스턴스의 이름으로 바꿉니다.출력으로
Instance setup finished가 표시될 때까지 3분 정도 기다린 다음 Ctrl+C를 누릅니다. 이제 VM 인스턴스를 사용할 수 있습니다.VM 인스턴스의 사용자 이름과 비밀번호를 만듭니다.
원격 데스크톱을 사용하여 VM에 연결하고 이전 단계에서 만든 사용자 이름과 비밀번호를 사용하여 로그인합니다.
시작 버튼을 마우스 오른쪽 버튼으로 클릭하고(또는 Win+X 누름) Windows PowerShell(관리자)을 클릭합니다.
- 예를 클릭하여 권한 승격 프롬프트를 확인합니다.
컴퓨터를 Active Directory 도메인에 연결하고 다시 시작합니다.
Add-Computer -Domain
DOMAIN -RestartDOMAIN을 Active Directory 도메인의 DNS 이름으로 바꿉니다.VM을 도메인에 조인할 수 있는 권한이 있는 계정의 사용자 인증 정보를 입력합니다. 다시 시작이 완료될 때까지 1분 정도 기다립니다.