Skip to content

Commit 17165b2

Browse files
authored
Update backup_configs.sh
updated for handling HTTPS Ambari
1 parent 5d822da commit 17165b2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

backup_configs.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ CLUSTER_NAME=Sandbox
44
AMBARI_USER=admin
55
AMBARI_PASSWORD=admin
66
AMBARI_PORT=8080
7+
AMBARI_PROTOCOL=http
8+
# set to empty if non secure
9+
AMBARI_SECURE="-s"
710
TIMENOW=`date +%Y%m%d_%H%M%S`
811
RESULT_DIR=/root/configs
912
mkdir -p $RESULT_DIR
10-
for CONFIG_TYPE in `curl -s -u $AMBARI_USER:$AMBARI_PASSWORD http://$AMBARI_HOST:$AMBARI_PORT/api/v1/clusters/$CLUSTER_NAME/?fields=Clusters/desired_configs | grep '" : {' | grep -v Clusters | grep -v desired_configs | cut -d'"' -f2`; do
13+
for CONFIG_TYPE in `curl -k -s -u $AMBARI_USER:$AMBARI_PASSWORD $AMBARI_PROTOCOL://$AMBARI_HOST:$AMBARI_PORT/api/v1/clusters/$CLUSTER_NAME/?fields=Clusters/desired_configs | grep '" : {' | grep -v Clusters | grep -v desired_configs | cut -d'"' -f2`; do
1114
echo "backuping $CONFIG_TYPE"
12-
/var/lib/ambari-server/resources/scripts/configs.sh -u $AMBARI_USER -p $AMBARI_PASSWORD -port $AMBARI_PORT get $AMBARI_HOST $CLUSTER_NAME $CONFIG_TYPE | grep '^"' | grep -v '^"properties" : {' | sed "1i ##### $CONFIG_TYPE #####" >> $RESULT_DIR/all.conf.$TIMENOW
15+
/var/lib/ambari-server/resources/scripts/configs.sh -u $AMBARI_USER -p $AMBARI_PASSWORD -port $AMBARI_PORT $AMBARI_SECURE get $AMBARI_HOST $CLUSTER_NAME $CONFIG_TYPE | grep '^"' | grep -v '^"properties" : {' | sed "1i ##### $CONFIG_TYPE #####" >> $RESULT_DIR/all.conf.$TIMENOW
1316
done

0 commit comments

Comments
 (0)