從 Service Fabric 叢集移除應用程式Remove an application from a Service Fabric cluster

這個範例指令碼會刪除一個執行中的 Service Fabric 應用程式執行個體,並將叢集中的一個應用程式類型和版本取消註冊。This sample script deletes a running Service Fabric application instance, then unregisters an application type and version from the cluster. 刪除應用程式執行個體也會刪除應用程式相關聯的所有執行中服務執行個體。Deleting the application instance also deletes all the running service instances associated with that application. 接下來,系統會從映像存放區刪除應用程式檔案。Next, the application files are deleted from the image store.

如有需要,請安裝 Service Fabric SDKIf needed, install the Service Fabric CLI.

範例指令碼Sample script

#!/bin/bash

# Select cluster
sfctl cluster select \
    --endpoint http://svcfab1.westus2.cloudapp.azure.com:19080

# Delete the application
sfctl application delete \
    --application-id svcfab_app \
    --timeout 500

# Unprovision the application type
sfctl application unprovision \
    --application-type-name svcfab_appType \
    --application-type-version 1.0.0 \
    --timeout 500

# Delete the application files from the image store
sfctl store delete \
    --content-path myappfolder

後續步驟Next steps

如需詳細資訊,請參閱 Service Fabric CLI 文件For more information, see the Service Fabric CLI documentation.

您可以在 Service Fabric CLI 範例中找到適用於 Azure Service Fabric 的其他 Service Fabric CLI 範例。Additional Service Fabric CLI samples for Azure Service Fabric can be found in the Service Fabric CLI samples.