VCF on VCD: Replace Hosts in Stretched Cluster
From one of my customers, I got a question on how they can downsize a stretched cluster in a VCF environment. This is basically following the first 5 steps in the “Replace a Failed Host in a Stretched Cluster” article: https://docs.vmware.com/en/VMware-Cloud-Foundation/5.0/vcf-admin/GUID-92FD3AEE-5B5F-421C-B722-44AE0314D84E.html
So I though, I’d try it out.
We need to do the following steps:
- Get Host ID’s
- Get Cluster ID
- Prepare JSON file
- Run JSON file
- Decommission hosts
So, first, we get the Host ID’s. For this we go to the “Developer Center” in the SDDC Manager and click on: API Explorer.
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-47.png?resize=640%2C71&ssl=1)
There we find the “Hosts” Categorie and Execute “Get”
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-48.png?resize=640%2C605&ssl=1)
We get a list of Hosts, and we can find the ones we need. In my case, I want to remove esx52 (because I have an issue with the local datastore) and to make things equal, I will also remove esx42:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/2023-10-22_15-45-58.jpg?resize=640%2C277&ssl=1)
From here we make a note of the “id”: (string) value. In these cases:
- “7178ffd0-08e2-4b23-a5ae-177f00942a03”
- “687d54c0-c166-449c-aa5f-bfc1c9a118d2”
Next, we will go looking for the Cluster ID. For this we find the Category Cluster, and Execute the “List” command:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-49.png?resize=526%2C514&ssl=1)
and get the Cluster ID for the cluster we are going to perform the activity on:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-50.png?resize=604%2C662&ssl=1)
So, the Cluster ID is: “83b5d49f-eea3-4b89-bb31-742c52076712”.
With this information, we go and create the correct JSON file:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-57.png?resize=452%2C160&ssl=1)
With this JSON, we go to the Category Clusters and find “Patch/v1/clusters/id and fill out the right information. The Cluster id as well as the content of the created JSON:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-56.png?resize=640%2C413&ssl=1)
and click on Execute. First, we get a confirmation and when we accept this, we will see a Task appearing in the Tasks list:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-55.png?resize=514%2C202&ssl=1)
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-58.png?resize=445%2C209&ssl=1)
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-59.png?resize=640%2C62&ssl=1)
and the subtasks:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-60.png?resize=640%2C484&ssl=1)
The hosts are placed in Maintenance Mode and removed:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-61.png?resize=492%2C288&ssl=1)
When all is done, the cluster is down two hosts and we see that there are two hosts that are available for Decommission in SDDC Manager:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-62.png?resize=396%2C236&ssl=1)
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-63.png?resize=640%2C63&ssl=1)
So we will Decommission them, clean them up, reinstall them, and then, part 2, add them to the cluster again.
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-64.png?resize=548%2C163&ssl=1)
After the reinstallation, we commission the hosts (see earlier posts on this) and after that, we go back to API Explorer.
The next steps follow the procedure described in: https://docs.vmware.com/en/VMware-Cloud-Foundation/5.0/vcf-admin/GUID-928542C0-65E1-46F1-A62D-E7A106AC593B.html#GUID-928542C0-65E1-46F1-A62D-E7A106AC593B
So, Part 2, adding hosts to a stretched cluster. For this, we follow the following steps:
- (Commission Hosts, this has already been done)
- Find the ID’s for the hosts (same way as in the first phase)
- Find the ID for the cluster (same way as in the first phase)
- Find the names for the Availability Zones
- Create JSON
- Execute JSON
The first 3 steps have been performed and give us:
Hosts:
- “a7a83ab2-c8fa-475f-b8b5-ca25003b80d5” – esx42 (AZ1)
- “d2531110-00a7-4fc1-89f5-bba928b2028b” – esx52 (AZ2)
Cluster:
- “83b5d49f-eea3-4b89-bb31-742c52076712”
The AZ Names, we find in vCenter:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-65.png?resize=640%2C111&ssl=1)
So:
- WLD02-CL01_primary-az-faultdomain (AZ1)
- WLD02-CL01_secondary-az-faultdomain (AZ2)
With this information, we can create our JSON:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-66.png?resize=545%2C576&ssl=1)
and run the JSON as part of the “Patch /v1/clusters/id”:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-67.png?resize=640%2C366&ssl=1)
Which creates the task:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-68.png?resize=640%2C203&ssl=1)
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-69.png?resize=640%2C80&ssl=1)
And it’s subtasks:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-70.png?resize=640%2C560&ssl=1)
And after this has been completed, we have two new shiny hosts, added to our stretched cluster:
![](https://i0.wp.com/my-sddc.net/wp-content/uploads/2023/10/afbeelding-71.png?resize=426%2C287&ssl=1)
(be it with some warnings, but those will be solved).