changeset 37:93de42761f9c

parameterise name
author Henry S. Thompson <ht@markup.co.uk>
date Thu, 29 Nov 2018 13:51:43 +0000
parents 9d4f130073b8
children beae6309d4ec
files master/bin/hd_create.sh
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/master/bin/hd_create.sh	Thu Nov 29 13:41:27 2018 +0000
+++ b/master/bin/hd_create.sh	Thu Nov 29 13:51:43 2018 +0000
@@ -1,6 +1,6 @@
 #!/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"
+u="Usage: hd_create.sh [-c filename] HDname\nWhere name will be prefixed with 'cc' to form\nthe name of an HDInsight cluster to create, and with 'CommonCrawl_' to give its password\nSaves config in named file if -c is present and file is writeable\n"
 set -e -o pipefail
 if [ $# -eq 1 ]
 then
@@ -19,10 +19,12 @@
  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"
+name=cc"$1"
+pwd=CommonCrawl_"$1"
 echo "Starting creation of $name, will take 15 minutes or so..."
-echo $cmd
+cmd="az hdinsight create -g cc -n $name -l southcentralus -s 4 -t hadoop -p $pwd -U cc --storage-account ccscsg.blob.core.windows.net --workernode-size Standard_D13_V2 --headnode-size Standard_D12_V2"
+bash -c "$cmd$save_conf"
 # 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
+ssh-keygen -R $name-ssh.azurehdinsight.net
+# let us in w/o password after this
+ssh $name-ssh.azurehdinsight.net "cat >> .ssh/authorized_keys" < /home/cc/.ssh/id_rsa.pub