changeset 35:1b6bcc54268d

what it says on the tin
author Henry S. Thompson <ht@markup.co.uk>
date Tue, 27 Nov 2018 19:08:08 +0000
parents ad6eff2bc6f9
children 9d4f130073b8
files master/bin/hd_create.sh
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/master/bin/hd_create.sh	Tue Nov 27 19:08:08 2018 +0000
@@ -0,0 +1,28 @@
+#!/bin/bash
+# Create an HDInsight cluster, and initialise ssh access to the head
+u="Usage: hd_create.sh [-c filename] HDname\nWhere name is the name of an HDInsight cluster to create\nSaves config in named file if -c is present and file is writeable\n"
+set -e -o pipefail
+if [ $# -eq 1 ]
+then
+ :
+elif [ \( $# -eq 3 \) -a \( "$1" = "-c" \) -a \( ! -d "$2" \) ]
+then
+ if >> "$2" 2>/dev/null
+ then
+  save_conf=" | tee \"$2\""
+  shift 2
+ else  
+  printf "$u" 1>&2
+  exit 1
+ fi
+else
+ printf "$u" 1>&2
+ exit 2
+fi
+name="$1"
+cmd="az hdinsight create -g cc -n $name -l southcentralus -s 4 -t hadoop -p CommonCrawl_hd1 -U cc --storage-account ccscsg.blob.core.windows.net --workernode-size Standard_D13_V2 --headnode-size Standard_D12_V2$save_conf"
+echo "Starting creation of $name, will take 15 minutes or so..."
+echo $cmd
+# remove old host key, if any
+ssh-keygen -R cchd1-ssh.azurehdinsight.net
+ssh cchd1-ssh.azurehdinsight.net "cat >> .ssh/authorized_keys" < /home/cc/.ssh/id_rsa.pub