IN THIS ARTICLE
Outlines how to shutdown a cluster using the Qumulo API with curl
REQUIREMENTS
- A computer with the curl and jq commands installed
- Admin privileges to your Qumulo cluster
For monitoring system-based automatic shutdown, please refer to the documentation of your monitoring system on triggering script execution for specific events or alerts.
DETAILS
Triggering a safe shutdown of a Qumulo cluster with automation or bash scripting is possible using the Qumulo API. We hope you never experience an HVAC failure in your data center or any other reason you may need to safely shut down your cluster due to an emergency. Should the need arise, this article will show you how you can use curl or a bash script to do so. Most modern network monitoring systems can handle event triggers or can execute a script based or shell commands based on alert criteria.
You can use the sample bash script below with your monitoring system to perform an emergency shutdown. It is important to know that shutting down a cluster while clients are writing to it may lead to the loss or corruption of data. Whenever possible, stop all client write activity before shutting down your cluster.
- First, you will need a bearer token to place further API calls at the Bash prompt or in your script, for example:
TOKEN=$(curl -k -X "POST" "https://qumulo.example.com:8000/v1/session/login"
-H "content: {}" -H "Content-Type: application/json; charset=utf-8" -s -S -d $'
{"username": "admin","password": "my_admin_password"}'| jq .bearer_token -r)
- Send the command to shutdown the cluster safely with the token that was just generated, for example:
PROMPT$ curl -k -X "GET" "https://qumulo.example.com:8000/v1/shutdown/halt" \n -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json"
- You can shut down the cluster with a single command, for example:
curl -k -X "POST" "https://qumulo.example.com:8000/v1/cluster/halt" -H "Authorization:
Bearer $(curl -k -X "POST" "https://qumulo.example.com:8000/v1/session/login" -H "content: {}" -H
"Content-Type: application/json; charset=utf-8" -s -S -d $'{"username": "admin","password":
"my_admin_password"}'| jq .bearer_token| sed 's/\"//g')" -H "Content-Type: application/json"
Note: You can also use the sample bash script "HaltCluster.sh" to achieve the same goal or as a starting point to customize the script for your needs.
RESOLUTION
You should now be able to successfully shutdown a Qumulo Cluster using API commands with curl
ADDITIONAL RESOURCES
QQ CLI: Comprehensive List of Commands
Like what you see? Share this article with your network!
Comments
1 comment