使用 Service Fabric CLI 从 Service Fabric 群集中删除应用程序Remove an application from a Service Fabric cluster using the Service Fabric CLI

此示例脚本删除了正在运行的 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 CLIIf needed, install the Service Fabric CLI.

示例脚本Sample script

#!/bin/bash

# Select cluster
sfctl cluster select \
    --endpoint http://svcfab1.chinanorth2.cloudapp.chinacloudapi.cn: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.