Dynamically determining master host