Standalone Cluster On a Single Machine: Same Rules Apply

I am running a stand alone service fabric cluster on a single, albeit beefy, physical server. This cluster has three virtual nodes. That’s because I am using a modified version of the Unsecure.DevCluster configuration template. There are other templates that will allow you to deploy to multiple physical (or virtual) machines but I don’t see the need for what I’m trying to accomplish.

I guess this is common sense but when hosting a web project like a stateless ASP.NET Core Web API because you are deploying to a single machine you can only deploy to one node because when it tries to open the same port on the other nodes it will error out saying the port is already opened.

Unhealthy event: SourceId=’System.RA’, Property=’ReplicaOpenStatus’, HealthState=’Warning’, ConsiderWarningAsError=false.

Replica had multiple failures during open on vm1. API call: IStatelessServiceInstance.Open(); Error = System.IO.IOException (-2146232800)

Failed to bind to address http://[object 0]:8308: address already in use.

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.d__5.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.d__7.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.AddressesStrategy.d__2.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.AddressBinder.d__0.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServer.d__21`1.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.AspNetCore.Hosting.Internal.WebHost.d__26.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.AspNetCore.Hosting.Internal.WebHost.Start()

at Microsoft.ServiceFabric.Services.Communication.AspNetCore.AspNetCoreCommunicationListener.OpenAsync(CancellationToken cancellationToken)

at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__19.MoveNext()

— End of stack trace from previous location where exception was thrown —

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

at Microsoft.ServiceFabric.Services.Runtime.StatelessServiceInstanceAdapter.d__13.MoveNext()

For more information see: http://aka.ms/sfhealth

Normally, when you deploy to a cluster hosted on Microsoft Azure you want the number of instances for a stateless service to be set to “-1”. This will deploy the stateless service to ALL nodes. However, in Azure, each of your nodes being a separate virtual machine means that you can open the same port on every node.

So I’ll create a copy of the Cloud deployment profile and modify it to only deploy to one node.

The easiest way I’ve found is to add the profile from the Publish Service Fabric Application screen. It will modify all the configuration files on your behalf. You can access it from the “Target profile” drop down and the “Application Parameters File” drop down.

Select Cloud.xml and hit “Create Copy”. Do this for both the “Target profile” and the “Application Parameters” just to keep everything clean.

Change the instance count from “-1” to “1”. Then you will only see it deployed to one node and won’t get any errors about not being able to open up ports.

There you go. Now you can still deploy to your Azure cluster when you are good and ready but you can take advantage of your stand alone cluster for the time being.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s