Skip to content

Instantly share code, notes, and snippets.

@jeongho
Last active October 1, 2016 03:02
Show Gist options
  • Save jeongho/0b7e0a4fe598fda98851bf1f6f8b82ef to your computer and use it in GitHub Desktop.
Save jeongho/0b7e0a4fe598fda98851bf1f6f8b82ef to your computer and use it in GitHub Desktop.
Export and Import CM config
#!/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