Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing application from service fabric cluster

I tried removing application from service fabric using service fabric explorer.

I deleted my application using Delete Application action. Then When I tried Unprovision application type I got error saying,

Error: Application Type of version 1.0.0 could not be unprovisioned as it still contains active applications.

I could see that even after deleting the application , the actor service inside the application is still active in some of the nodes. Am attaching a screenshot of my service fabric explorer.

Any help regarding completely removing the applications?

like image 501
DevMJ Avatar asked Mar 03 '16 06:03

DevMJ


People also ask

How do I remove a local service Fabric cluster?

Sign in to Azure and select the subscription ID with which you want to remove the cluster. You can find your subscription ID by logging in to the Azure portal. Delete the resource group and all the cluster resources using the Remove-AzResourceGroup cmdlet or az group delete command.

Is service Fabric still relevant?

Service Fabric clusters deployed via Azure and Service Fabric Standalone are unaffected and will remain fully supported and available for customers.

How do I reset a Fabric node service?

The Service Fabric node to be restarted can specified in the following ways: Specify node name and optionally the node instance ID. Specify a stateful service replica or stateless service instance and let the cmdlet identify and restart the node that hosts it.


1 Answers

This can happen if services in your application don't play nice by not shutting down when requested by the platform, for example by ignoring the cancellation token in RunAsync.

Here's a quick PowerShell script that will go through an application and force remove all replicas of all stateful services:

Connect-ServiceFabricCluster -ConnectionEndpoint localhost:19000

$nodes = Get-ServiceFabricNode

foreach($node in $nodes)
{
    $replicas = Get-ServiceFabricDeployedReplica -NodeName $node.NodeName -ApplicationName "fabric:/MyApp"

    foreach ($replica in $replicas)
    {
        Remove-ServiceFabricReplica -ForceRemove -NodeName $node.NodeName -PartitionId $replica.Partitionid -ReplicaOrInstanceId $replica.ReplicaOrInstanceId
    }
}
like image 174
Vaclav Turecek Avatar answered Nov 13 '22 11:11

Vaclav Turecek