When trying to query VMs
Invoke-VrGetLocalVms -pairingId {pairing UUID} -vcenterId {vCenter UUID}
to configure replication on vSphere replication, it fails with 503 Service unavailable.
vSphere Replication 9.x
The issue is that the request to retrieve all VMs objects from vCenter is taking too long, probably due to the total number of VMs objects.
In order to optimize the query, use suitable_for_replication=true in the query parameter (It will filter only VMs which are suitable for replication and are not already replicated). Details in 'Get Local Vms' in VMware vSphere Replication Rest API Gateway Developer Portal
Apply the following steps to increase the timeouts of the REST API.
1. In /opt/vmware/dr-rest/lib/dr-rest-api.properties increase the response timeout to 10 minutes (600 000 ms):
responseTimeout=600000
2. Restart dr-rest service
systemctl restart dr-rest.service