Skip to content

Instantly share code, notes, and snippets.

@rammanokar
Created October 16, 2020 06:39
Show Gist options
  • Select an option

  • Save rammanokar/7648077fbe40492e9b35e228a1eaa277 to your computer and use it in GitHub Desktop.

Select an option

Save rammanokar/7648077fbe40492e9b35e228a1eaa277 to your computer and use it in GitHub Desktop.
Ambari Start all the services
#!/bin/env bash
SERVER="xxxxxxxxxx:8080"
AMBARI_ADMIN_USER="admin"
AMBARI_ADMIN_PASSWORD="************"
CLUSTER_NAME="xxxxx"
STATE="STARTED"
generate_post_data()
{
cat <<EOF
{ "RequestInfo":
{ "context": "_PARSE_.START.ALL_SERVICES", "operation_level":
{"level":"CLUSTER","cluster_name":"${CLUSTER_NAME}"}
},"Body":{"ServiceInfo":{"state":"${STATE}"}}}
EOF
}
curl -i -u ${AMBARI_ADMIN_USER}:${AMBARI_ADMIN_PASSWORD} -H "X-Requested-By: ambari" \
-X PUT -d "$(generate_post_data)" http://${SERVER}/api/v1/clusters/${CLUSTER_NAME}/services
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment