Last active
October 1, 2016 03:02
-
-
Save jeongho/0b7e0a4fe598fda98851bf1f6f8b82ef to your computer and use it in GitHub Desktop.
Export and Import CM config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://cloudera.github.io/cm_api/docs/quick-start/ | |
# https://www.cloudera.com/documentation/enterprise/latest/topics/cm_intro_api.html | |
set -o pipefail | |
set +o errexit | |
set -x | |
username=${username:-admin} | |
password=${password:-admin} | |
output_file=cm_config.$(date +%Y%m%d).json | |
# export config | |
curl -u "$username:$password" \ | |
http://cm_server_host:7180/api/v13/cm/deployment > $output_file | |
# import config | |
curl -H "Content-Type: application/json" \ | |
--upload-file $output_file -u "$username:$password" \ | |
http://cm_server_host:7180/api/v13/cm/deployment?deleteCurrentDeployment=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment