Hi D D,
yes, up on installation of each Gateway you need to specify a management server it reports to. This automatically bcomes the Primary Management Server of an Gateway.
You can assign a Seconday Management Server or even a List of Secondary Management servers, all this, using PowerShell.
This is covered in great details with examples here:
Assigning Gateways and Agents to Management Servers using PowerShell
and the same examples are listed in official MS Learn documentation for SCOM:
To configure gateway server failover between management servers
I hope I could help you out!
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Stoyan Chalakov