Installation and deployment
Version 7.x > Installation and deployment > Web Farm - Enabled, but servers can't see one another View modes: 
User avatar
Member
Member
EWiley - 12/6/2013 2:12:19 PM
   
Web Farm - Enabled, but servers can't see one another
Hello-
I have a site which has two servers, connected by a web farm.
The web farm no longer appears to be working (it previously worked).

On each server, I have
<add key="CMSWebFarmUseDBUpdater" value="true" />

The settings show this:
User image
But yet the servers show this:
User image
Again, the web farm has worked previously, but now they seem to not be able to see one another.

User avatar
Member
Member
EWiley - 12/6/2013 2:16:38 PM
   
RE:Web Farm - Enabled, but servers can't see one another
To fix it I can go to Site Manager -> Administration -> System and Restart the Application, but I'd prefer not to do this if I don't have to.

Is there a reason why this happens, and how can it be avoided in the future?
Thanks.

User avatar
Member
Member
kentico_sandroj - 12/6/2013 7:28:49 PM
   
RE:Web Farm - Enabled, but servers can't see one another
Hello,

Just to confirm, are you using the CMSWebFarmGenarateServers key in your Web.config? If not, you would have to register each server.

What exactly is not working? Are the tasks not being created, synched or erroring out? Do you have any Web Farm related errors under Site Manager > Administration > Event Log?

Are you using a load balancer/offloader?

Have you defined the machine keys?

Best Regards,
Sandro

User avatar
Member
Member
EWiley - 12/6/2013 8:58:30 PM
   
RE:Web Farm - Enabled, but servers can't see one another
I have "Generate servers dynamically" turned on in the CMS. The documentation tells me that it shouldn't be necessary to have a web.config setting if I have that turned on.

I have defined the machine keys.

I am using an azure-based load balancer, but I'm not sure how that would affect the web farm, the primary issue is the web farm servers not be generated dynamically -- though what causes this is unknown.

There are several errors in the event long which deal with the web farm. I've included the detail on one of them below...

As for what's not working, the web farm servers appear to not generate properly (no servers will be listed).
Message: [DataConnection.HandleError]: Query: Proc_CMS_WebFarmSync_SetServerTasks: caused exception: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_WebFarmServerTask_ServerID_CMS_WebFarmServer". The conflict occurred in database "CornerBakeryCafe.Kentico", table "dbo.CMS_WebFarmServer", column 'ServerID'.
The statement has been terminated.
Stack Trace:
at CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, SqlException ex)
at CMS.DataProviderSQL.DataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction)
at CMS.SettingsProvider.SqlHelperClass.ExecuteQuery(QueryParameters query)
at CMS.SettingsProvider.WebSyncHelperClass.SetServerTasks(Int32 serverId, Int32 taskId, IDataConnection conn)
at CMS.SettingsProvider.WebSyncHelperClass.InsertWebFarmTaskInDB(QueryDataParameters parameters, Hashtable servers, Int32 serverId, Boolean createAnonymousTask)
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_WebFarmServerTask_ServerID_CMS_WebFarmServer". The conflict occurred in database "CornerBakeryCafe.Kentico", table "dbo.CMS_WebFarmServer", column 'ServerID'.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at CMS.DataProviderSQL.DataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction)

User avatar
Member
Member
EWiley - 12/7/2013 8:06:23 AM
   
RE:Web Farm - Enabled, but servers can't see one another
Here's more detail.

On server one, I see this:
User image

On server two, I see this:
User image

This doesn't seem right. What am I missing?

User avatar
Member
Member
EWiley - 12/7/2013 8:11:42 AM
   
RE:Web Farm - Enabled, but servers can't see one another
Those images didn't upload well. Here are better ones.

Server 1:
User image
Server 2:
User image
Why do they both have sever 1 as the only registered server in the web farm?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 12/8/2013 9:01:22 PM
   
RE:Web Farm - Enabled, but servers can't see one another
Nothing against the "auto generate" feature but I found it to be a bit buggy and simply created a separate app.config file and pointed to it in my web.config. Then since file replication (MS DFS) was in place on the servers I was working with I simply generated a GUID and used that as the folder name so it could be excluded within the file replication. This allowed me to have file replication as needed and still have unique web farm servers setup.

No problems whatsoever now that I did that and we can perform any updates to our web.config as we need as the custom settings are off in a different file

User avatar
Member
Member
EWiley - 12/9/2013 10:27:34 AM
   
RE:Web Farm - Enabled, but servers can't see one another
Thanks, Frogg.

I think I'm going to avoid using the autogenerate setting in the CMS in favor of the more traditional web.config-based setup.

I'll let everyone know how it goes.