You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2009/12/02 06:25:12 UTC

svn commit: r886052 - in /hadoop/hbase/trunk: CHANGES.txt src/contrib/ec2/bin/create-hbase-image src/contrib/ec2/bin/functions.sh src/contrib/ec2/bin/hbase-ec2-env.sh src/contrib/ec2/bin/image/create-hbase-image-remote

Author: apurtell
Date: Wed Dec  2 05:25:12 2009
New Revision: 886052

URL: http://svn.apache.org/viewvc?rev=886052&view=rev
Log:
HBASE-2019  [EC2] remember credentials if not configured

Added:
    hadoop/hbase/trunk/src/contrib/ec2/bin/functions.sh
Modified:
    hadoop/hbase/trunk/CHANGES.txt
    hadoop/hbase/trunk/src/contrib/ec2/bin/create-hbase-image
    hadoop/hbase/trunk/src/contrib/ec2/bin/hbase-ec2-env.sh
    hadoop/hbase/trunk/src/contrib/ec2/bin/image/create-hbase-image-remote

Modified: hadoop/hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/CHANGES.txt?rev=886052&r1=886051&r2=886052&view=diff
==============================================================================
--- hadoop/hbase/trunk/CHANGES.txt (original)
+++ hadoop/hbase/trunk/CHANGES.txt Wed Dec  2 05:25:12 2009
@@ -212,6 +212,7 @@
    HBASE-1995  Add configurable max value size check (Lars George via Andrew
                Purtell)
    HBASE-2017  Set configurable max value size check to 10MB
+   HBASE-2019  [EC2] remember credentials if not configured
 
   NEW FEATURES
    HBASE-1901  "General" partitioner for "hbase-48" bulk (behind the api, write

Modified: hadoop/hbase/trunk/src/contrib/ec2/bin/create-hbase-image
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/ec2/bin/create-hbase-image?rev=886052&r1=886051&r2=886052&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/ec2/bin/create-hbase-image (original)
+++ hadoop/hbase/trunk/src/contrib/ec2/bin/create-hbase-image Wed Dec  2 05:25:12 2009
@@ -64,6 +64,10 @@
 
 # Copy setup scripts
 scp $SSH_OPTS "$bin"/hbase-ec2-env.sh "root@$HOSTNAME:/mnt"
+scp $SSH_OPTS "$bin"/functions.sh "root@$HOSTNAME:/mnt"
+if [ -f "$bin"/credentials.sh ] ; then
+  scp $SSH_OPTS "$bin"/credentials.sh "root@$HOSTNAME:/mnt"
+fi
 scp $SSH_OPTS "$bin"/image/create-hbase-image-remote "root@$HOSTNAME:/mnt"
 scp $SSH_OPTS "$bin"/image/ec2-run-user-data "root@$HOSTNAME:/etc/init.d"
 

Added: hadoop/hbase/trunk/src/contrib/ec2/bin/functions.sh
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/ec2/bin/functions.sh?rev=886052&view=auto
==============================================================================
--- hadoop/hbase/trunk/src/contrib/ec2/bin/functions.sh (added)
+++ hadoop/hbase/trunk/src/contrib/ec2/bin/functions.sh Wed Dec  2 05:25:12 2009
@@ -0,0 +1,19 @@
+function getCredentialSetting {
+  name=$1
+  eval "val=\$$name"
+  if [ -z "$val" ] ; then
+    if [ -f "$bin"/credentials.sh ] ; then
+      val=`cat "$bin"/credentials.sh | grep $name | awk 'BEGIN { FS="=" } { print $2; }'`
+      if [ -z "$val" ] ; then
+        echo -n "$name: "
+        read -e val
+        echo "$name=$val" >> "$bin"/credentials.sh
+      fi
+    else
+      echo -n "$name: "
+      read -e val
+      echo "$name=$val" >> "$bin"/credentials.sh
+    fi
+    eval "$name=$val"
+  fi
+}

Modified: hadoop/hbase/trunk/src/contrib/ec2/bin/hbase-ec2-env.sh
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/ec2/bin/hbase-ec2-env.sh?rev=886052&r1=886051&r2=886052&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/ec2/bin/hbase-ec2-env.sh (original)
+++ hadoop/hbase/trunk/src/contrib/ec2/bin/hbase-ec2-env.sh Wed Dec  2 05:25:12 2009
@@ -1,4 +1,4 @@
-# Set environment variables for running Hbase on Amazon EC2 here. All are required.
+# Set environment variables for running Hbase on Amazon EC2 here.
 
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
@@ -30,19 +30,8 @@
 # Your AWS certificate file -- must begin with 'cert' and end with '.pem'
 EC2_CERT=
 
-# Location of EC2 keys.
-# The default setting is probably OK if you set up EC2 following the Amazon Getting Started guide.
-EC2_KEYDIR=`dirname "$EC2_PRIVATE_KEY"`
-
-# Where your EC2 private key is stored (created when following the Amazon Getting Started guide).
-# You need to change this if you don't store this with your other EC2 keys.
-PRIVATE_KEY_PATH=`echo "$EC2_KEYDIR"/"id_rsa_root"`
-
-# SSH options used when connecting to EC2 instances.
-SSH_OPTS=`echo -q -i "$PRIVATE_KEY_PATH" -o StrictHostKeyChecking=no -o ServerAliveInterval=30`
-
-# Global tool options
-TOOL_OPTS=`echo -K "$EC2_PRIVATE_KEY" -C "$EC2_CERT"`
+# Your AWS root SSH key
+EC2_ROOT_SSH_KEY=
 
 # The version of HBase to use.
 HBASE_VERSION=0.20.2
@@ -51,18 +40,13 @@
 HADOOP_VERSION=0.20.1
 
 # The Amazon S3 bucket where the HBase AMI is stored.
-# The default value is for public images, so can be left if you are using running a public image.
 # Change this value only if you are creating your own (private) AMI
 # so you can store it in a bucket you own.
 S3_BUCKET=hbase-images
 
 # Enable public access web interfaces
-# XXX -- Generally, you do not want to do this
 ENABLE_WEB_PORTS=false
 
-# The script to run on instance boot.
-USER_DATA_FILE=hbase-ec2-init-remote.sh
-
 # Use only c1.xlarge unless you know what you are doing
 MASTER_INSTANCE_TYPE=${MASTER_INSTANCE_TYPE:-c1.xlarge}
 
@@ -72,6 +56,29 @@
 # Use only c1.medium unless you know what you are doing
 ZOO_INSTANCE_TYPE=${ZOO_INSTANCE_TYPE:-c1.medium}
 
+############################################################################
+
+# Generally, users do not need to edit below
+
+bin=`dirname "$0"`
+bin=`cd "$bin"; pwd`
+. "$bin"/functions.sh
+getCredentialSetting 'AWS_ACCOUNT_ID'
+getCredentialSetting 'AWS_ACCESS_KEY_ID'
+getCredentialSetting 'AWS_SECRET_ACCESS_KEY'
+getCredentialSetting 'EC2_PRIVATE_KEY'
+getCredentialSetting 'EC2_CERT'
+getCredentialSetting 'EC2_ROOT_SSH_KEY'
+
+# SSH options used when connecting to EC2 instances.
+SSH_OPTS=`echo -q -i "$EC2_ROOT_SSH_KEY" -o StrictHostKeyChecking=no -o ServerAliveInterval=30`
+
+# EC2 command request timeout (seconds)
+REQUEST_TIMEOUT=300    # 5 minutes
+
+# Global tool options
+TOOL_OPTS=`echo -K "$EC2_PRIVATE_KEY" -C "$EC2_CERT" --request-timeout $REQUEST_TIMEOUT`
+
 # The EC2 group master name. CLUSTER is set by calling scripts
 CLUSTER_MASTER=$CLUSTER-master
 
@@ -84,9 +91,8 @@
 CLUSTER_ZOOKEEPER=$CLUSTER-zookeeper
 ZOOKEEPER_QUORUM_PATH=~/.hbase-quorum-$CLUSTER_ZOOKEEPER
 
-#
-# The following variables are only used when creating an AMI.
-#
+# The script to run on instance boot.
+USER_DATA_FILE=hbase-ec2-init-remote.sh
 
 # The version number of the installed JDK.
 JAVA_VERSION=1.6.0_17

Modified: hadoop/hbase/trunk/src/contrib/ec2/bin/image/create-hbase-image-remote
URL: http://svn.apache.org/viewvc/hadoop/hbase/trunk/src/contrib/ec2/bin/image/create-hbase-image-remote?rev=886052&r1=886051&r2=886052&view=diff
==============================================================================
--- hadoop/hbase/trunk/src/contrib/ec2/bin/image/create-hbase-image-remote (original)
+++ hadoop/hbase/trunk/src/contrib/ec2/bin/image/create-hbase-image-remote Wed Dec  2 05:25:12 2009
@@ -30,8 +30,9 @@
 echo "Remote: INSTANCE_TYPE is $type"
 echo "Remote: ARCH is $arch"
 
-# Remove environment script since it contains sensitive information
+# Remove sensitive information
 rm -f "$bin"/hbase-ec2-env.sh
+rm -f "$bin"/credentials.sh
 
 # Install Java
 echo "Downloading and installing java binary."