[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-22(UTC)"],[[["\u003cp\u003eA SQL Server premium image with SQL Server 2022 preinstalled can be used, or users can opt for Windows Server base images and install SQL Server with their own licenses via the license mobility program.\u003c/p\u003e\n"],["\u003cp\u003eA third VM is deployed as a file share witness to provide a tie-breaking vote and ensure quorum for failover.\u003c/p\u003e\n"],["\u003cp\u003eA specialize script is utilized to install necessary Windows features and establish firewall rules for the failover cluster and SQL Server, as well as format the data disk and create folders.\u003c/p\u003e\n"],["\u003cp\u003eVM instances are created, and the two cluster node VMs have an additional data disk attached and Windows Server Failover Clustering enabled using metadata.\u003c/p\u003e\n"],["\u003cp\u003eEach of the three VM instances must be added to an active directory domain, and credentials must be provided to facilitate joining the VM to the active directory domain.\u003c/p\u003e\n"]]],[],null,["You use a [SQL Server premium image](/compute/docs/images/os-details#sql_server)\nwhich has SQL Server 2022 preinstalled.\n| **Note:** If you plan to bring your own licenses for SQL Server by using the [license Mobility](/compute/docs/instances/windows/ms-licensing) program, select Windows Server base images for these nodes and install SQL Server using your own product keys.\n\nTo provide a tie-breaking vote and achieve a quorum for the failover scenario,\nyou deploy a third VM that serves as a\n[file share witness](https://docs.microsoft.com/en-us/windows-server/failover-clustering/manage-cluster-quorum#quorum-configuration-options).\n\n1. Return to your existing Cloud Shell session.\n2. Create a [specialize script](/compute/docs/startupscript#providing_a_startup_script_for_windows_instances)\n for the cluster nodes. The script installs the necessary Windows feature and creates\n firewall rules for the failover cluster and SQL Server.\n\n ```\n cat \u003c\u003c \"EOF\" \u003e specialize-node.ps1\n\n $ErrorActionPreference = \"stop\"\n\n # Install required Windows features\n Install-WindowsFeature Failover-Clustering -IncludeManagementTools\n Install-WindowsFeature RSAT-AD-PowerShell\n\n # Open firewall for availability group listener\n netsh advfirewall firewall add rule name=\"Allow SQL Server Listener health check\" dir=in action=allow protocol=TCP localport=59997\n\n # Open firewall for the Failover Cluster\n netsh advfirewall firewall add rule name=\"Allow SQL Server health check\" dir=in action=allow protocol=TCP localport=59998\n\n # Open firewall for SQL Server\n netsh advfirewall firewall add rule name=\"Allow SQL Server\" dir=in action=allow protocol=TCP localport=1433\n\n # Open firewall for SQL Server replication\n netsh advfirewall firewall add rule name=\"Allow SQL Server replication\" dir=in action=allow protocol=TCP localport=5022\n\n # Format data disk\n Get-Disk |\n Where partitionstyle -eq 'RAW' |\n Initialize-Disk -PartitionStyle MBR -PassThru |\n New-Partition -AssignDriveLetter -UseMaximumSize |\n Format-Volume -FileSystem NTFS -NewFileSystemLabel 'Data' -Confirm:$false\n\n # Create data and log folders for SQL Server\n md d:\\Data\n md d:\\Logs\n EOF\n ```\n3. Create the VM instances. On the two VMs that serve as cluster nodes,\n attach an additional data disk and enable the Windows Server Failover Clustering\n by setting the metadata key `enable-wsfc` to `true`.\n\n ```\n REGION=$(gcloud config get-value compute/region)\n ZONE1=$(gcloud config get-value compute/zone)\n ZONE2=$(gcloud config get-value compute/zone)\n ZONE3=$(gcloud config get-value compute/zone)\n PD_SIZE=200\n MACHINE_TYPE=n2-standard-8\n\n gcloud compute instances create node-1 \\\n --zone $ZONE1 \\\n --machine-type $MACHINE_TYPE \\\n --subnet $SUBNET_NAME \\\n --image-family sql-ent-2022-win-2022 \\\n --image-project windows-sql-cloud \\\n --tags wsfc,wsfc-node \\\n --boot-disk-size 50 \\\n --boot-disk-type pd-ssd \\\n --boot-disk-device-name \"node-1\" \\\n --create-disk=name=node-1-datadisk,size=$PD_SIZE,type=pd-ssd,auto-delete=no \\\n --metadata enable-wsfc=true \\\n --metadata-from-file=sysprep-specialize-script-ps1=specialize-node.ps1\n\n gcloud compute instances create node-2 \\\n --zone $ZONE2 \\\n --machine-type $MACHINE_TYPE \\\n --subnet $SUBNET_NAME \\\n --image-family sql-ent-2022-win-2022 \\\n --image-project windows-sql-cloud \\\n --tags wsfc,wsfc-node \\\n --boot-disk-size 50 \\\n --boot-disk-type pd-ssd \\\n --boot-disk-device-name \"node-2\" \\\n --create-disk=name=node-2-datadisk,size=$PD_SIZE,type=pd-ssd,auto-delete=no \\\n --metadata enable-wsfc=true \\\n --metadata-from-file=sysprep-specialize-script-ps1=specialize-node.ps1\n\n gcloud compute instances create \"witness\" \\\n --zone $ZONE3 \\\n --machine-type n2-standard-2 \\\n --subnet $SUBNET_NAME \\\n --image-family=windows-2022 \\\n --image-project=windows-cloud \\\n --tags wsfc \\\n --boot-disk-size 50 \\\n --boot-disk-type pd-ssd \\\n --metadata sysprep-specialize-script-ps1=\"add-windowsfeature FS-FileServer\"\n ```\n | **Note:** Depending on your [performance requirements](/compute/docs/disks/performance#optimize_disk_performance), consider using a machine type larger than `n2-standard-8` for the cluster nodes.\n | **Note:** For the purpose of this tutorial, and to fit within the default regional SSD Persistent Disk quota, the size of the disks attached to each VM is smaller than it would be in a production environment. For better performance and to accommodate a larger database, you would increase the size of each disk.\n4. To join the 3 VM instances to Active Directory, do the following for each of\n the 3 VM instances.\n\n 1. Monitor the initialization process of the VM by viewing its serial port output.\n\n gcloud compute instances tail-serial-port-output \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e with the name of the VM instance.\n\n Wait about 3 minutes until you see the output `Instance setup finished`,\n then press Ctrl+C. At this point, the VM instance is ready to be used.\n 2. [Create a username and password](/compute/docs/instances/windows/creating-passwords-for-windows-instances)\n for the VM instance.\n\n 3. [Connect to the VM by using Remote Desktop](/compute/docs/instances/connecting-to-windows)\n and sign in using the username and password created in the previous step.\n\n 4. Right-click the **Start** button (or press **Win+X** ) and click **Windows PowerShell (Admin)**.\n\n | **Note:** In this guide, we used Powershell 5.1.\n 1. Confirm the elevation prompt by clicking **Yes**.\n 2. Join the computer to your Active Directory domain and restart.\n\n Add-Computer -Domain \u003cvar translate=\"no\"\u003eDOMAIN\u003c/var\u003e -Restart\n\n Replace \u003cvar translate=\"no\"\u003eDOMAIN\u003c/var\u003e with the DNS name of your Active Directory domain.\n 3. Enter the credentials of an account that has permissions to join a VM to\n the domain. Wait for approximately 1 minute for the restart to complete."]]