HBASE-2019 [EC2] remember credentials if not configured

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@886052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Kyle Purtell 2009-12-02 05:25:12 +00:00
parent bf32e51013
commit 6f56688341
5 changed files with 54 additions and 23 deletions

View File

@ -212,6 +212,7 @@ Release 0.21.0 - Unreleased
HBASE-1995 Add configurable max value size check (Lars George via Andrew HBASE-1995 Add configurable max value size check (Lars George via Andrew
Purtell) Purtell)
HBASE-2017 Set configurable max value size check to 10MB HBASE-2017 Set configurable max value size check to 10MB
HBASE-2019 [EC2] remember credentials if not configured
NEW FEATURES NEW FEATURES
HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write HBASE-1901 "General" partitioner for "hbase-48" bulk (behind the api, write

View File

@ -64,6 +64,10 @@ echo "Copying scripts."
# Copy setup scripts # Copy setup scripts
scp $SSH_OPTS "$bin"/hbase-ec2-env.sh "root@$HOSTNAME:/mnt" 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/create-hbase-image-remote "root@$HOSTNAME:/mnt"
scp $SSH_OPTS "$bin"/image/ec2-run-user-data "root@$HOSTNAME:/etc/init.d" scp $SSH_OPTS "$bin"/image/ec2-run-user-data "root@$HOSTNAME:/etc/init.d"

View File

@ -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
}

View File

@ -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 # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -30,19 +30,8 @@ EC2_PRIVATE_KEY=
# Your AWS certificate file -- must begin with 'cert' and end with '.pem' # Your AWS certificate file -- must begin with 'cert' and end with '.pem'
EC2_CERT= EC2_CERT=
# Location of EC2 keys. # Your AWS root SSH key
# The default setting is probably OK if you set up EC2 following the Amazon Getting Started guide. EC2_ROOT_SSH_KEY=
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"`
# The version of HBase to use. # The version of HBase to use.
HBASE_VERSION=0.20.2 HBASE_VERSION=0.20.2
@ -51,18 +40,13 @@ HBASE_VERSION=0.20.2
HADOOP_VERSION=0.20.1 HADOOP_VERSION=0.20.1
# The Amazon S3 bucket where the HBase AMI is stored. # 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 # Change this value only if you are creating your own (private) AMI
# so you can store it in a bucket you own. # so you can store it in a bucket you own.
S3_BUCKET=hbase-images S3_BUCKET=hbase-images
# Enable public access web interfaces # Enable public access web interfaces
# XXX -- Generally, you do not want to do this
ENABLE_WEB_PORTS=false 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 # Use only c1.xlarge unless you know what you are doing
MASTER_INSTANCE_TYPE=${MASTER_INSTANCE_TYPE:-c1.xlarge} MASTER_INSTANCE_TYPE=${MASTER_INSTANCE_TYPE:-c1.xlarge}
@ -72,6 +56,29 @@ SLAVE_INSTANCE_TYPE=${SLAVE_INSTANCE_TYPE:-c1.xlarge}
# Use only c1.medium unless you know what you are doing # Use only c1.medium unless you know what you are doing
ZOO_INSTANCE_TYPE=${ZOO_INSTANCE_TYPE:-c1.medium} 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 # The EC2 group master name. CLUSTER is set by calling scripts
CLUSTER_MASTER=$CLUSTER-master CLUSTER_MASTER=$CLUSTER-master
@ -84,9 +91,8 @@ MASTER_ZONE_PATH=~/.hbase-zone-$CLUSTER_MASTER
CLUSTER_ZOOKEEPER=$CLUSTER-zookeeper CLUSTER_ZOOKEEPER=$CLUSTER-zookeeper
ZOOKEEPER_QUORUM_PATH=~/.hbase-quorum-$CLUSTER_ZOOKEEPER ZOOKEEPER_QUORUM_PATH=~/.hbase-quorum-$CLUSTER_ZOOKEEPER
# # The script to run on instance boot.
# The following variables are only used when creating an AMI. USER_DATA_FILE=hbase-ec2-init-remote.sh
#
# The version number of the installed JDK. # The version number of the installed JDK.
JAVA_VERSION=1.6.0_17 JAVA_VERSION=1.6.0_17

View File

@ -30,8 +30,9 @@ arch=$ARCH
echo "Remote: INSTANCE_TYPE is $type" echo "Remote: INSTANCE_TYPE is $type"
echo "Remote: ARCH is $arch" 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"/hbase-ec2-env.sh
rm -f "$bin"/credentials.sh
# Install Java # Install Java
echo "Downloading and installing java binary." echo "Downloading and installing java binary."