我为冗余系统在数据库之间建立了同步。
我已经在机器和2台运行良好的测试服务器上测试了代码。
我试图将其引入到我们已完成所有设置的生产系统中。
我为服务器启用了tcp以进行通信。
当程序启动时,设置了作用域,我可以看到已创建_tracking表和所有存储过程。
但是,在开始同步过程时,还是会发生其他情况。 由于服务器没有响应,因此在超时错误中运行。
正如我所看到的那样,表和存储过程是在另一台服务器上创建的,我知道自己无法访问该服务器。 但是,当应将数据从原始服务器发送到辅助服务器时,它将失败。
SyncOrchestrator syncOrchestrator = new SyncOrchestrator
{
// ProductsScope in the SyncCompactDB compact client database
LocalProvider = new SqlSyncProvider(primaryScope, primaryConnection),
// set the remote provider of orchestrator to a server sync provider associated with
// the ProductsScope in the SyncDB server database
RemoteProvider = new SqlSyncProvider(secondaryScope, secondaryConnection),
// set the direction of sync session to Upload and Download
Direction = SyncDirectionOrder.UploadAndDownload
};
// subscribe for errors that occur when applying changes to the client
((SqlSyncProvider)syncOrchestrator.LocalProvider).ApplyChangeFailed += new EventHandler<DbApplyChangeFailedEventArgs>(Program_ApplyChangeFailed);
// execute the synchronization process
try
{
if (secondaryConnection.State == ConnectionState.Closed)
{
secondaryConnection.Open();
}
if (primaryConnection.State == ConnectionState.Closed)
{
primaryConnection.Open();
}
Console.WriteLine("State of primary conection: {0}", primaryConnection.State);
Console.WriteLine("State of secondary conection: {0}", secondaryConnection.State);
Console.WriteLine("Start synchronizing");
SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
// print statistics
Console.WriteLine("Start Time: " + syncStats.SyncStartTime);
Console.WriteLine("Total Changes Uploaded: " + syncStats.UploadChangesTotal);
Console.WriteLine("Total Changes Downloaded: " + syncStats.DownloadChangesTotal);
Console.WriteLine("Complete Time: " + syncStats.SyncEndTime);
Console.WriteLine(String.Empty);
}
我也无法在sql事件探查器中看到辅助服务器上有任何活动。 您有什么想法可以检查以找出问题所在吗?