-
-
Save jeongho/7015175 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright 2013 Cloudera Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
# check if group exists | |
ec2-describe-group alexm-dev | |
# of if EC2 installer, jclouds#whatevernamehere | |
# create group: allow SSH externally, no restrictions within group | |
ec2-add-group alexm-dev -d "alexm demo instances" | |
ec2-authorize alexm-dev -P tcp -p 22 | |
ec2-authorize alexm-dev -P icmp --icmp-type-code -1:-1 -o alexm-dev | |
ec2-authorize alexm-dev -P tcp -p -1 -o alexm-dev | |
ec2-authorize alexm-dev -P udp -p -1 -o alexm-dev | |
# two AMIs, both have a limited 10GB root partition :-/ | |
# ami-ccb35ea5 RightScale CentOS 5.4 (root) | |
# ami-e76ac58e Bashton CentOS 6.3 (ec2-user) | |
# start a proxy/CM/utility node, then start cluster nodes | |
ec2-run-instances ami-ccb35ea5 --group alexm-dev --key alexm-dev --instance-type m1.small | |
ec2-run-instances ami-ccb35ea5 --group alexm-dev --key alexm-dev --instance-type m1.large --instance-count 5 | |
# check if nodes are up | |
ec2-describe-instances --filter group-name=alexm-dev | |
# dump instance data, for laziness | |
ec2-describe-instances --filter group-name=alexm-dev > ec2_instances.txt | |
awk '/^INSTANCE/ { print $2 }' ec2_instances.txt > my_instances.txt | |
awk '/^INSTANCE.*large/ { print $5 }' ec2_instances.txt > my_cluster.txt | |
awk '/^INSTANCE.*large/ { print $4 }' ec2_instances.txt > my_cluster_public.txt | |
awk '/^INSTANCE.*small/ { print $4 }' ec2_instances.txt > my_proxy.txt | |
# start standalone tunnel for proxy requests to internal services | |
ssh -D localhost:6666 -N `cat my_proxy.txt` | |
# copy keys to utility node, more important w/ multiple users | |
cp -av ~/.ssh/alexm-dev.pub ec2_cm_demo.pub | |
cp -av ~/.ssh/alexm-dev.pem ec2_cm_demo.pem | |
scp ec2_cm_demo.p* `cat my_proxy.txt`: | |
scp my_cluster.txt `cat my_proxy.txt`: | |
# the rest is done from the proxy node | |
ssh `cat my_proxy.txt` | |
# distribute public keys to nodes, also our dev private key as well (in case agent forwarding doesn't work) | |
mv ec2_cm_demo.pem ~/.ssh/id_rsa | |
mv ec2_cm_demo.pub >> ~/.ssh/authorized_keys | |
for host in `cat my_cluster.txt`; do scp ~/.ssh/authorized_keys $host:~/.ssh/authorized_keys; done | |
# do the install | |
wget http://archive.cloudera.com/cm4/installer/latest/cloudera-manager-installer.bin | |
chmod 755 cloudera-manager-installer.bin | |
./cloudera-manager-installer.bin --i-agree-to-all-licenses --noreadme | |
# back to our browser... | |
# if forced into cloud-based EC2 installer, legacy install can be accessed via URI | |
# http://INTERNAL_HOSTNAME:7180/cmf/express-wizard/welcome | |
# terminate all instances | |
for host in `cat my_instances.txt`; do ec2-terminate-instances $host; done | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment