In this setup the regular users on-site have an application frontend installed locally on their computer, while the data resides on a central SQL Server. Some users works off-site, and randomly connects to the company's data network. These users have SQL Server Express installed locally on their laptop which their frontend application connects to. The SQL Server Express is configured as subscribers with Merge Replication. Whenever the off-site users connect to the company's data network through VPN a small program runs the "replmerge.exe" program on a schedule in the background, keeping the data in sync.
To improve the uptime for the regular users on-site the database has been moved to a configuration with AlwaysOn Availability Group with a primary replica and a secondary replica. The on-site users connect to the Availability Group through the Availability Group Listener, this works perfectly for on-site users if a failover occurs.
The primary replica is also set up as the publisher for the Merge Replication while the Distributor role is being taking care of by a different SQL Server. When the off-site users run the "replmerge.exe"-command they connect directly to the primary replica/publisher. This works very well as long as the Availability Group is running on the primary replica, but if the Availability Group fails over to the secondary replica the pull subscribers off-site will not be able to replicate. I wish the subscribers could be configured to connect to the Availability Group Listener instead of directly to the primary replica/publisher, but that will not work.
In http://msdn.microsoft.com/en-us/library/hh882436.aspx I can the following:
Failover of a Merge Pull Subscription
A pull subscription fails upon availability group failover, because pull agent cannot find the jobs stored in the msdb database of the server instance that hosts the primary replica; which is not available because the server instance has failed.
But I’m not sure if this is a problem when the Publisher is configured in a Availability Group or when the Subscriber is configured in a Publisher Group. I’m not sure if this is a problem if the replication is triggered by the “replmerge.exe”-command and not by a SQL Server Agent job.
My questions are:
- -Have anyone accomplished to get Merge Replication with Pull Subscription connect to the Publisher using an Availability Group Listener working?
- -In the setup described, will it be possible to reconfigure the subscriber from connecting to the primary replica to the secondary replica in the Availability Group if the Availability Group fails over? If so, any ideas of how to script this so it happens automatically? Is It possible to achieve any of this without having the subscriber to download the snapshot again?
Thanks,
Anders