Based on what I understand of your architecture, you have Server A and Server B that are located in the same hosting environment because the Database can be shared.
So I make the assumption that both server A and server B can access the DB of the other server or simply use another server for the DBs.
In this case, you effectivelly need 2 masters - one on each server to provide the joomla application (php code) on each server.
If you want to share the template, articles, module, menu between the different website, you need to share the whole content of the websites.
If you don't want to share the whole content but just some content, see the list of extension for which the content can be shared.
www.jms2win.com/en/list-of-extensions?vi...id=269&Itemid=53
The articles, modules and menus can NOT be shared/
For the article, you need the "Article Sharing for JMS" to read the articles coming from another website.
www.jms2win.com/en/joomla-multisite?page...47&category_id=1
For the menu, you can only share the menu item (not the whole menu).
To do that, you need the "Multisites Menu Item"
www.jms2win.com/en/joomla-multisite?page...36&category_id=1
Concerning the modules, there is no "multisites modules" extension.
When you share the content of an extension, this mean that the MySQL tables are physically shared. Therefore, you have the same content in both websites and you can manage it from any places as the content is unique (shared).
In summary, you either share the whole content or check in the "list of extension" the one that can have their content shared.