Introduction
Demonstrate how to stop and delete an Elastifile Cloud File System (ECFS) cluster using the EMS SSH and then the gcloud UI or CLI.
PLEASE NOTE: ALL THE STEPS BELOW ARE IRREVERSIBLE. PLEASE BE SURE TO VERIFY THE COMMANDS and reach out to ELASTIFILE SUPPORT before running these commands.
Detailed Procedure (CLI
1. Login and SSH to the EMS System
sudo su -
source /root/elfs_admin
2. Disabling NO-DELETE-PROTECTION FLAG on ELFS Storage Nodes :
for IP in $(elfs-cli enode list | sed '1d' | awk '{ print $7 }'| sed '/^$/d'); do for NAME in $(elfs-cli host list | sed '1d' | grep $IP| awk '{ print $29 }' | sed '/^$/d'); do for ZONE in $(elfs-cli enode list | sed '1d' | awk '{ print $7,$12 }'| grep $IP | awk '{ print $2 }'| sed '/^$/d'); do gcloud compute instances update $NAME --no-deletion-protection --zone $ZONE;done ; done; done
|
3. Deleting ELFS Storage Nodes :
for IP in $(elfs-cli enode list | sed '1d' | awk '{ print $7 }'| sed '/^$/d'); do for NAME in $(elfs-cli host list | sed '1d' | grep $IP| awk '{ print $29 }' | sed '/^$/d'); do for ZONE in $(elfs-cli enode list | sed '1d' | awk '{ print $7,$12 }'| grep $IP | awk '{ print $2 }'| sed '/^$/d'); do gcloud -q compute instances delete $NAME --delete-disks=all --zone $ZONE;done ; done; done
|
4. Disabling NO-DELETE-PROTECTION FLAG on Replication Service Nodes :
for IP in $(elfs-cli host list | sed '1d' | grep ra | awk '{ print $2 }' |sed '/^$/d'); do for NAME in $(elfs-cli host list | sed '1d' | grep $IP |awk '{ print $28 }' | sed '/^$/d'); do for ZONE in $(elfs-cli replication_service list| sed '1d'| awk '{ print $10,$11 }'| grep $IP | awk '{ print $2 }'| sed '/^$/d'); do gcloud compute instances update $NAME --no-deletion-protection --zone $ZONE;done ; done; done
|
5. Deleting Replication Service Nodes :
for IP in $(elfs-cli host list | sed '1d' | grep ra | awk '{ print $2 }' |sed '/^$/d'); do for NAME in $(elfs-cli host list | sed '1d' | grep $IP |awk '{ print $28 }' | sed '/^$/d'); do for ZONE in $(elfs-cli replication_service list| sed '1d'| awk '{ print $10,$11 }'| grep $IP | awk '{ print $2 }'| sed '/^$/d'); do gcloud -q compute instances delete $NAME --delete-disks=all --zone $ZONE;done ; done; done
|
6. Setting up before we delete further. Extracting EMSNAME, PROJECT and ZONE.
export EMSNAME=`hostname`
export PROJECT=`gcloud info|grep project|awk -F"[" '{print $2}'|awk -F"]" '{print $1}'`
export ZONE=`elfs-cli cloud_provider show --id 1|grep "zone:"|awk '{print $2}'`
|
7. Delete firewall rules :
for i in $(gcloud compute firewall-rules list --project=$PROJECT --filter=$EMSNAME --format="table(name)"| sed '1d' | awk '{ print $1 }'); do gcloud compute firewall-rules delete $i --project $PROJECT --quiet ; done
|
8. Delete the routes :
for i in $(gcloud compute routes list --project=$PROJECT --filter=$EMSNAME --format="table(name)"| sed '1d' | awk '{ print $1 }'); do gcloud compute routes delete $i --project $PROJECT --quiet ; done
|
9. Delete Cloud Buckets
Deleting bucket :
PLEASE NOTE : The deletion time of the bucket depends on the number and size of objects.
for i in $(elfs-cli data_container list | awk '{print $1}' | grep -o '^[0-9]*$'); do gsutil -m rm -r gs://$(elfs-cli data_container show --id $i --json | jq -r '.bucket_name'); done
10. Delete EMS Instance
Disabling NO-DELETE-PROTECTION FLAG
gcloud compute instances update $EMSNAME --no-deletion-protection --zone $ZONE --quiet
|
Deleting EMS
gcloud compute instances delete $EMSNAME --delete-disks=all --zone $ZONE --quiet
|