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/05 23:03:01 UTC
svn commit: r887597 - in /hadoop/hbase/branches/0.20/src/contrib/ec2/bin:
create-hbase-image functions.sh hbase-ec2-env.sh
image/create-hbase-image-remote launch-hbase-zookeeper
Author: apurtell
Date: Sat Dec 5 22:03:00 2009
New Revision: 887597
URL: http://svn.apache.org/viewvc?rev=887597&view=rev
Log:
HBASE-1961 EC2 scripts; sync 0.20 branch with trunk
Added:
hadoop/hbase/branches/0.20/src/contrib/ec2/bin/functions.sh
Modified:
hadoop/hbase/branches/0.20/src/contrib/ec2/bin/create-hbase-image
hadoop/hbase/branches/0.20/src/contrib/ec2/bin/hbase-ec2-env.sh
hadoop/hbase/branches/0.20/src/contrib/ec2/bin/image/create-hbase-image-remote
hadoop/hbase/branches/0.20/src/contrib/ec2/bin/launch-hbase-zookeeper
Modified: hadoop/hbase/branches/0.20/src/contrib/ec2/bin/create-hbase-image
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/contrib/ec2/bin/create-hbase-image?rev=887597&r1=887596&r2=887597&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/contrib/ec2/bin/create-hbase-image (original)
+++ hadoop/hbase/branches/0.20/src/contrib/ec2/bin/create-hbase-image Sat Dec 5 22:03:00 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/branches/0.20/src/contrib/ec2/bin/functions.sh
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/contrib/ec2/bin/functions.sh?rev=887597&view=auto
==============================================================================
--- hadoop/hbase/branches/0.20/src/contrib/ec2/bin/functions.sh (added)
+++ hadoop/hbase/branches/0.20/src/contrib/ec2/bin/functions.sh Sat Dec 5 22:03:00 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/branches/0.20/src/contrib/ec2/bin/hbase-ec2-env.sh
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/contrib/ec2/bin/hbase-ec2-env.sh?rev=887597&r1=887596&r2=887597&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/contrib/ec2/bin/hbase-ec2-env.sh (original)
+++ hadoop/hbase/branches/0.20/src/contrib/ec2/bin/hbase-ec2-env.sh Sat Dec 5 22:03:00 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,14 @@
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
+#S3_BUCKET=hbase-images
+S3_BUCKET=iridiant-bundles
# 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 +57,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 +92,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/branches/0.20/src/contrib/ec2/bin/image/create-hbase-image-remote
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/contrib/ec2/bin/image/create-hbase-image-remote?rev=887597&r1=887596&r2=887597&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/contrib/ec2/bin/image/create-hbase-image-remote (original)
+++ hadoop/hbase/branches/0.20/src/contrib/ec2/bin/image/create-hbase-image-remote Sat Dec 5 22:03:00 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."
Modified: hadoop/hbase/branches/0.20/src/contrib/ec2/bin/launch-hbase-zookeeper
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/contrib/ec2/bin/launch-hbase-zookeeper?rev=887597&r1=887596&r2=887597&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/contrib/ec2/bin/launch-hbase-zookeeper (original)
+++ hadoop/hbase/branches/0.20/src/contrib/ec2/bin/launch-hbase-zookeeper Sat Dec 5 22:03:00 2009
@@ -49,7 +49,7 @@
peers=""
public_names=""
-for inst in `seq 1 $NO_INSTANCES` ; do
+for inst in {1..$NO_INSTANCES} ; do
echo "Starting an AMI with ID $ZOO_AMI_IMAGE (arch $arch) in group $CLUSTER_ZOOKEEPER"
INSTANCE=`ec2-run-instances $ZOO_AMI_IMAGE $TOOL_OPTS -n 1 -g $CLUSTER_ZOOKEEPER -k root -t $type | grep INSTANCE | awk '{print $2}'`
echo -n "Waiting for instance $INSTANCE to start: "