Changing the Primary Zone in a Citrix Outage Scenario

With the more recent releases of XenApp/XenDesktop, Citrix reintroduced the concept of Zones.  Unlike Zones in XenApp 6.5, the 7.x version is more of a parent/child relationship.  You have a Primary zone which handles all of the communication to the database(s), and then secondary Zones which communicate to the Primary.  Zones are less flexible in this configuration but still very useful for scenarios like DR.  Think of it like this… you have your Primary DC which is where all your production infra lives.  You build your Citrix infra there.  You have a warm DR site as well.  In the past, you would have had to build an entirely new Site there with all the overhead required for it.  Now, using Zones, you simply build a couple Delivery Controllers and connect them to the hosting infra local to DR.  Use NetScaler as your GSLB to detect when the Primary zone is down and redirect your users to DR and voila, they can still connect!

But there’s a problem with that scenario.  When the Primary zone is down, you lose the ability to manage the Site through the Delivery Controller GUI.  Remember, database connectivity all runs through the Primary Zone.  Now one school of thought says “Well, your Primary Zone is down so you’ve likely lost your database anyway and the important point is your users can connect!”  In my experience that’s seldom true.  Most customers are doing some form of HA for SQL, whether it’s mirroring or AlwaysOn or even just restoring it in an outage.  So your SQL remains up but your Primary Zone Delivery Controllers are down… you still can’t manage the Site.  Thankfully there is a way to fix it!  And that answer is PoSh:

Set-ConfigSite -PrimaryZone <Zone>

That command, run from your Secondary Zone DDC, will switch the defined Primary Zone over and allow database communication to resume.  Huzzah!  It’s important to keep this one in your back pocket if you intend to use Zones AND you have HA SQL involved.  Otherwise you may have to scramble to restore your Primary Zone faster than intended.

Many thanks to the Citrix folks who pointed this out to me 🙂

, ,


  • […] Changing the Primary Zone in a Citrix Outage Scenario – CTP Paul Stansel […]

  • Mark D says:

    This is perfect. My whole plan was to implement DR using SQL AlwaysOn + Zones, this looks like it would fill the last gap.

    I am confused though on the sentence “Well, your Primary Zone is down so you’ve likely lost your database anyway and the important point is your users can connect!”. In a case where SQL HA isn’t making the database available in another location, wouldn’t connection leasing come into play? With connection leasing, how would a user every connect to a resource in DR? My understanding is that a non-primary zone only keeps connection leasing information for its own zone.

    • Paul says:

      Connection Leasing would try and send them to the Primary Zone, which is now down in this scenario. It’s not just a matter of SQL failure, I’m assuming the entire Zone infrastructure and guests are unavailable. Now if you lose SQL only but NOT the Primary Zone infra/guests then yes the normal connection leasing rules would apply. CL is not DR however. Hope that clarifies.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">