Skip to content

Commit e570884

Browse files
author
Nicolas Oman
committed
added verbose instructions
1 parent caf44a5 commit e570884

File tree

1 file changed

+143
-46
lines changed

1 file changed

+143
-46
lines changed

articles/service-fabric/service-fabric-scale-up-node-type.md

Lines changed: 143 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -36,80 +36,163 @@ Here is the process for updating the VM size and operating system of the primary
3636
10. Remove the node state of the nodes from the cluster. If the durability level of the old scale set was silver or gold, this step is done by the system automatically.
3737
11. If you deployed the stateful application in a previous step, verify that the application is functional.
3838

39-
```powershell
40-
# Variables.
41-
$groupname = "sfupgradetestgroup"
42-
$clusterloc="southcentralus"
43-
$subscriptionID="<your subscription ID>"
39+
## Set up the test cluster
40+
41+
Begin by downloading the two sets of files we'll need for this tutorial, the before [template]() and [parameters]() and the after [template]() and [parameters]().
4442

43+
Next, sign in to your Azure account.
44+
45+
```powershell
4546
# sign in to your Azure account and select your subscription
46-
Login-AzAccount -SubscriptionId $subscriptionID
47+
Login-AzAccount -SubscriptionId "<your subscription ID>"
48+
```
49+
50+
This tutorial walks through the scenario of creating a self-signed certificate. To use an existing certificate from Azure Key Vault, skip the step below and instead mirror the steps in [using an existing certificate to deploy the cluster](https://docs.microsoft.com/azure/service-fabric/upgrade-managed-disks#use-an-existing-certificate-to-deploy-the-cluster).
51+
52+
### Generate a self-signed certificate and deploy the cluster
53+
54+
First, assign the variables you'll need for Service Fabric cluster deployment. Adjust the values for `resourceGroupName`, `certSubjectName`, `parameterFilePath`, and `templateFilePath` for your specific account and environment:
55+
56+
```powershell
57+
# Assign deployment variables
58+
$resourceGroupName = "sftestupgradegroup"
59+
$certOutputFolder = "c:\certificates"
60+
$certPassword = "Password!1" | ConvertTo-SecureString -AsPlainText -Force
61+
$certSubjectName = "sftestupgrade.southcentralus.cloudapp.azure.com"
62+
$templateFilePath = "C:\Deploy-2NodeTypes-2ScaleSets.json"
63+
$parameterFilePath = "C:\Deploy-2NodeTypes-2ScaleSets.parameters.json"
64+
```
65+
66+
> [!NOTE]
67+
> Ensure that the `certOutputFolder` location exist on your local machine before running the command to deploy a new Service Fabric cluster.
68+
69+
Next open the *Deploy-2NodeTypes-2ScaleSets.parameters.json* file and adjust the values for `clusterName` and `dnsName` to correspond to the dynamic values you set in PowerShell and save your changes.
70+
71+
Then deploy the Service Fabric test cluster:
72+
73+
```powershell
74+
# Deploy the initial test cluster
75+
New-AzServiceFabricCluster `
76+
-ResourceGroupName $resourceGroupName `
77+
-CertificateOutputFolder $certOutputFolder `
78+
-CertificatePassword $certPassword `
79+
-CertificateSubjectName $certSubjectName `
80+
-TemplateFile $templateFilePath `
81+
-ParameterFile $parameterFilePath
82+
```
83+
84+
Once the deployment is complete, locate the *.pfx* file (`$certPfx`) on your local machine and import it to your certificate store:
85+
86+
```powershell
87+
cd c:\certificates
88+
$certPfx = ".\sftestupgradegroup20200312121003.pfx"
4789
48-
# Create a new resource group for your deployment and give it a name and a location.
49-
New-AzResourceGroup -Name $groupname -Location $clusterloc
90+
Import-PfxCertificate `
91+
-FilePath $certPfx `
92+
-CertStoreLocation Cert:\CurrentUser\My `
93+
-Password (ConvertTo-SecureString Password!1 -AsPlainText -Force)
94+
```
95+
96+
The operation will return the certificate thumbprint, which you'll use to connect to the new cluster and check its health status.
5097

51-
# Deploy the two node type cluster.
52-
New-AzResourceGroupDeployment -ResourceGroupName $groupname -TemplateParameterFile "C:\temp\cluster\Deploy-2NodeTypes-2ScaleSets.parameters.json" `
53-
-TemplateFile "C:\temp\cluster\Deploy-2NodeTypes-2ScaleSets.json" -Verbose
98+
### Connect to the new cluster and check health status
5499

55-
# Connect to the cluster and check the cluster health.
56-
$ClusterName= "sfupgradetest.southcentralus.cloudapp.azure.com:19000"
57-
$thumb="F361720F4BD5449F6F083DDE99DC51A86985B25B"
100+
Connect to the cluster and ensure that all of its nodes are healthy (replacing the `clusterName` and `thumb` variables for your cluster):
101+
102+
```powershell
103+
# Connect to the cluster
104+
$clusterName = "sftestupgrade.southcentralus.cloudapp.azure.com:19000"
105+
$thumb = "BB796AA33BD9767E7DA27FE5182CF8FDEE714A70"
58106
59-
Connect-ServiceFabricCluster -ConnectionEndpoint $ClusterName -KeepAliveIntervalInSec 10 `
107+
Connect-ServiceFabricCluster `
108+
-ConnectionEndpoint $clusterName `
109+
-KeepAliveIntervalInSec 10 `
60110
-X509Credential `
61111
-ServerCertThumbprint $thumb `
62112
-FindType FindByThumbprint `
63113
-FindValue $thumb `
64114
-StoreLocation CurrentUser `
65-
-StoreName My
115+
-StoreName My
66116
117+
# Check cluster health
67118
Get-ServiceFabricClusterHealth
119+
```
120+
121+
We are ready to begin the upgrade procedure.
122+
123+
## Upgrade the primary node type VMs
124+
125+
After deciding to upgrade the primary node type VMs, add a new scale set to the primary node type such that the primary node type now has two scale sets. A sample [template](https://github.com/Azure/service-fabric-scripts-and-templates/blob/master/templates/nodetype-upgrade/Deploy-2NodeTypes-3ScaleSets.json) and [parameters](https://github.com/Azure/service-fabric-scripts-and-templates/blob/master/templates/nodetype-upgrade/Deploy-2NodeTypes-3ScaleSets.parameters.json) files have been provided to show the necessary changes. The new scale set's VMs are size Standard D4_V2 and run Windows Server 2016 Datacenter with Containers. A new load balancer and public IP address are also added with the new scale set.
68126

69-
# Deploy a new scale set into the primary node type. Create a new load balancer and public IP address for the new scale set.
70-
New-AzResourceGroupDeployment -ResourceGroupName $groupname -TemplateParameterFile "C:\temp\cluster\Deploy-2NodeTypes-3ScaleSets.parameters.json" `
71-
-TemplateFile "C:\temp\cluster\Deploy-2NodeTypes-3ScaleSets.json" -Verbose
127+
To find the new scale set in the template, search for the "Microsoft.Compute/virtualMachineScaleSets" resource named by the vmNodeType2Name parameter. The new scale set is added to the primary node type using the properties->virtualMachineProfile->extensionProfile->extensions->properties->settings->nodeTypeRef setting.
72128

73-
# Check the cluster health again. All 15 nodes should be healthy.
129+
### Deploy the updated template
130+
131+
Adjust the `parameterFilePath` and `templateFilePath` as needed and then run the following command:
132+
133+
```powershell
134+
# Deploy the new scale set (upgraded to use managed disks) into the primary node type.
135+
$templateFilePath = "C:\Upgrade-1NodeType-2ScaleSets-ManagedDisks.json"
136+
$parameterFilePath = "C:\Upgrade-1NodeType-2ScaleSets-ManagedDisks.parameters.json"
137+
138+
New-AzResourceGroupDeployment `
139+
-ResourceGroupName $resourceGroupName `
140+
-TemplateFile $templateFilePath `
141+
-TemplateParameterFile $parameterFilePath `
142+
-CertificateThumbprint $thumb `
143+
-CertificateUrlValue $certUrlValue `
144+
-SourceVaultValue $sourceVaultValue `
145+
-Verbose
146+
```
147+
148+
When the deployment completes, check the cluster health again and ensure all nodes (on the original and on the new scale set) are healthy.
149+
150+
```powershell
74151
Get-ServiceFabricClusterHealth
152+
```
75153

154+
## Migrate nodes to the new scale set
155+
156+
We're now ready to start disabling the nodes of the original scale set. As these nodes become disabled, the system services and seed nodes migrate to the VMs of the new scale set because it is also marked as the primary node type.
157+
158+
```powershell
76159
# Disable the nodes in the original scale set.
77160
$nodeNames = @("_NTvm1_0","_NTvm1_1","_NTvm1_2","_NTvm1_3","_NTvm1_4")
78161
79162
Write-Host "Disabling nodes..."
80163
foreach($name in $nodeNames){
81164
Disable-ServiceFabricNode -NodeName $name -Intent RemoveNode -Force
82165
}
166+
```
83167

84-
Write-Host "Checking node status..."
85-
foreach($name in $nodeNames){
86-
87-
$state = Get-ServiceFabricNode -NodeName $name
88-
89-
$loopTimeout = 50
90-
91-
do{
92-
Start-Sleep 5
93-
$loopTimeout -= 1
94-
$state = Get-ServiceFabricNode -NodeName $name
95-
Write-Host "$name state: " $state.NodeDeactivationInfo.Status
96-
}
97-
98-
while (($state.NodeDeactivationInfo.Status -ne "Completed") -and ($loopTimeout -ne 0))
99-
100-
101-
if ($state.NodeStatus -ne [System.Fabric.Query.NodeStatus]::Disabled)
102-
{
103-
Write-Error "$name node deactivation failed with state" $state.NodeStatus
104-
exit
105-
}
106-
}
168+
Use Service Fabric Explorer to monitor the migration of seed nodes to the new scale set and the progression of nodes in the original scale set from *Disabling* to *Disabled* status.
169+
170+
> [!NOTE]
171+
> It may take some time to complete the disabling operation across all the nodes of the original scale set. To guarantee data consistency, only one seed node can change at a time. Each seed node change requires a cluster update; thus replacing a seed node requires two cluster upgrades (one each for node addition and removal). Upgrading the five seed nodes in this sample scenario will result in ten cluster upgrades.
172+
173+
## Remove the original scale set
174+
175+
Once the disabling operation is complete, remove the scale set.
176+
177+
```powershell
178+
# Remove the original scale set
179+
$scaleSetName = "NTvm1"
180+
181+
Remove-AzVmss `
182+
-ResourceGroupName $resourceGroupName `
183+
-VMScaleSetName $scaleSetName `
184+
-Force
107185
108-
# Remove the scale set
109-
$scaleSetName="NTvm1"
110-
Remove-AzVmss -ResourceGroupName $groupname -VMScaleSetName $scaleSetName -Force
111186
Write-Host "Removed scale set $scaleSetName"
187+
```
188+
189+
In Service Fabric Explorer, the removed nodes (and thus the *Cluster Health State*) will now appear in *Error* state.
190+
191+
## Remove the old load balancer and update DNS settings
192+
193+
Now, we can remove the resources related to the old primary node type, beginning with the load balancer and the old public IP.
112194

195+
```powershell
113196
$lbname="LB-sfupgradetest-NTvm1"
114197
$oldPublicIpName="PublicIP-LB-FE-0"
115198
$newPublicIpName="PublicIP-LB-FE-2"
@@ -126,16 +209,28 @@ Remove-AzLoadBalancer -Name $lbname -ResourceGroupName $groupname -Force
126209
127210
# Remove the old public IP
128211
Remove-AzPublicIpAddress -Name $oldPublicIpName -ResourceGroupName $groupname -Force
212+
```
129213

214+
Next, we update the DNS settings of the new public IP to mirror the settings from the old primary node type's public IP.
215+
216+
```powershell
130217
# Replace DNS settings of Public IP address related to new Primary Node Type with DNS settings of Public IP address related to old Primary Node Type
131218
$PublicIP = Get-AzPublicIpAddress -Name $newPublicIpName -ResourceGroupName $groupname
132219
$PublicIP.DnsSettings.DomainNameLabel = $primaryDNSName
133220
$PublicIP.DnsSettings.Fqdn = $primaryDNSFqdn
134221
Set-AzPublicIpAddress -PublicIpAddress $PublicIP
222+
```
223+
224+
Once more, check the cluster health
135225

226+
```powershell
136227
# Check the cluster health
137228
Get-ServiceFabricClusterHealth
229+
```
138230

231+
Finally, remove the node state for each of the related nodes. If durability level of the old scale set was silver or gold, this will occur automatically.
232+
233+
```powershell
139234
# Remove node state for the deleted nodes.
140235
foreach($name in $nodeNames){
141236
# Remove the node from the cluster
@@ -144,6 +239,8 @@ foreach($name in $nodeNames){
144239
}
145240
```
146241

242+
The cluster's primary node type has now been upgraded. Verify that any deployed applications function properly and cluster health is ok.
243+
147244
## Next steps
148245
* Learn how to [add a node type to a cluster](virtual-machine-scale-set-scale-node-type-scale-out.md)
149246
* Learn about [application scalability](service-fabric-concepts-scalability.md).

0 commit comments

Comments
 (0)