Launch EC2 cluster with Whirr - hadoop

I am working through the tutorial of Jeffery Breen at the moment. I got some troubles when I would like to launch a ec2 cluster with Whirr. I use a cloudera demo vm cdh3u4.
I downloaded the version 0.8.1 of whirr.
Here are all commands I ran:
$ wget http://mirror.switch.ch/mirror/apache/dist/whirr/whirr-0.8.1/whirr-0.8.1.tar.gz
$ tar zxf whirr-0.8.0.tar.gz
$ export PATH="~/whirr-0.8.0/bin:$PATH"
$ export AWS_ACCESS_KEY_ID=MY ACCESS KEY
$ export AWS_SECRET_ACCESS_KEY=MY SECRET ACCESS KEY
$ ssh-keygen -t rsa -P hadoop-ec2
Then I was asked in which file the key should be safed and I typed: hadoop-ec2
$ whirr launch-cluster --config hadoop-ec2.properties
...and here is the problem: There were no instances launched! I got the following message:
Exception in thread "main" org.apache.commons.configuration.ConfigurationException: Cannot locate configuration source hadoop-ec2.properties
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:249)
at org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:229)
at org.apache.commons.configuration.AbstractFileConfiguration.<init>(AbstractFileConfiguration.java:149)
at org.apache.commons.configuration.PropertiesConfiguration.<init>(PropertiesConfiguration.java:252)
at org.apache.whirr.command.AbstractClusterCommand.getClusterSpec(AbstractClusterCommand.java:122)
at org.apache.whirr.cli.command.LaunchClusterCommand.run(LaunchClusterCommand.java:57)
at org.apache.whirr.cli.Main.run(Main.java:69)
at org.apache.whirr.cli.Main.main(Main.java:102)
What I did next is link the properties-file directly to the file that Jeffrey Breen published in his tutorial and then I got the following thing:
[cloudera#localhost ~]$ whirr launch-cluster --config /home/cloudera/TutorialBreen/config/whirr-ec2/hadoop-ec2.properties
Running on provider aws-ec2 using identity ${env:AKIAIXPYW6EBNWSZWMTQ}
Bootstrapping cluster
Configuring template for bootstrap-hadoop-datanode_hadoop-tasktracker
Unable to start the cluster. Terminating all nodes.
org.jclouds.rest.AuthorizationException: POST https://ec2.us-east-1.amazonaws.com/ HTTP/1.1 -> HTTP/1.1 401 Unauthorized
at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.refineException(ParseAWSErrorFromXmlContent.java:123)
at org.jclouds.aws.handlers.ParseAWSErrorFromXmlContent.handleError(ParseAWSErrorFromXmlContent.java:92)
at org.jclouds.http.handlers.DelegatingErrorHandler.handleError(DelegatingErrorHandler.java:69)
at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.shouldContinue(BaseHttpCommandExecutorService.java:197)
at org.jclouds.http.internal.BaseHttpCommandExecutorService$HttpResponseCallable.call(BaseHttpCommandExecutorService.java:167) . . .
Was this a step into the right direction and if yes, what do I have to do that it works?
I am a very beginner so I'd really appreciate your help and if possible, als "clear" as possible since I am - as I said - a beginner.
The next step would be to run this command:
$ whirr run-script --script install-r+packages.sh --config hadoop-ec2.properties
I really hope to find some help here so that I can continue with the tutorial.
Whirr-config-File:
whirr.cluster-name=hadoop-ec2
# Change the number of machines in the cluster here
whirr.instance-templates=1 hadoop-namenode+hadoop-jobtracker,5 hadoop-datanode+hadoop-tasktracker
# whirr.instance-templates=1 hadoop-namenode+hadoop-jobtracker,1 hadoop-datanode+hadoop-tasktracker
# Uncomment out these lines to run CDH
# You need cdh3 because of the streaming combiner backport
whirr.hadoop.install-function=install_cdh_hadoop
whirr.hadoop.configure-function=configure_cdh_hadoop
# make sure java is set up correctly, requires Whirr >= 0.7.1
whirr.java.install-function=install_oab_java
# For EC2 set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
whirr.provider=aws-ec2
whirr.identity=${env:DFD...(mycode)..DFDSDF}
whirr.credential=${env:df342.(mycode)..3434324}
# The size of the instance to use. See http://aws.amazon.com/ec2/instance-types/
whirr.hardware-id=m1.large
# whirr.hardware-id=c1.xlarge
# select recent, 64-bit CentOS 5.6 AMI from RightScale
whirr.image-id=us-east-1/ami-49e32320
# here's what Cloudera recommends:
# whirr.image-id=us-east-1/ami-ccb35ea5
# If you choose a different location, make sure whirr.image-id is updated too
whirr.location-id=us-east-1
# You can also specify the spot instance price
# http://aws.amazon.com/ec2/spot-instances/
# whirr.aws-ec2-spot-price=0.109
# By default use the user system SSH keys. Override them here.
# whirr.private-key-file=${sys:user.home}/.ssh/id_rsa
# whirr.public-key-file=${sys:user.home}/.ssh/id_rsa.pub
# Expert: override Hadoop properties by setting properties with the prefix
# hadoop-common, hadoop-hdfs, hadoop-mapreduce to set Common, HDFS, MapReduce
# site properties, respectively. The prefix is removed by Whirr, so that for
# example, setting
# hadoop-common.fs.trash.interval=1440
# will result in fs.trash.interval being set to 1440 in core-site.xml.
# Expert: specify the version of Hadoop to install.
#whirr.hadoop.version=0.20.2
#whirr.hadoop.tarball.url=http://archive.apache.org/dist/hadoop/core/hadoop-${whirr.hadoop.version}/hadoop-${whirr.hadoop.version}.tar.gz

yes remove #
Sample here:
whirr.private−key−file=${sys:user.home}/.ssh/whirr_id_rsa
whirr.public−key−file=${sys:user.home}/.ssh/whirr_id_rsa.pub
repalce whirr_id_rsa with your file name. More details here:
http://www.xmsxmx.com/apache-whirr-create-hadoop-cluster-automatically/

Related

How do I migrate a nifi 1.10.0 flow.xml.gz to 1.14 or newer versions: sensitive properties

I have a dataflow running in NiFi 1.10.0, the relevant properties from this installation is here:
nifi.sensitive.props.key=
nifi.sensitive.props.key.protected=
nifi.sensitive.props.algorithm=PBEWITHMD5AND256BITAES-CBC-OPENSSL
nifi.sensitive.props.provider=BC
nifi.sensitive.props.additional.keys=
I am trying to migrate the flowfile to the 1.15.2 install where the properties are
nifi.sensitive.props.key=<redacted>
nifi.sensitive.props.key.protected=
nifi.sensitive.props.algorithm=NIFI_PBKDF2_AES_GCM_256
nifi.sensitive.props.additional.keys=
Found this section in the NiFi admin guide to help with the migration.
Has anyone done this, what command options did you use?
Also is this a two step process since I am going from a blank key to a non-empty one and also changing the algorithm at the same time?
I used this command and the conversion works fine when you don't change the algorithm. Basically just setting a key when it was not set in the earlier 1.10.0 install.
$ ./nifi-toolkit-1.15.2/bin/encrypt-config.sh -f /path/to/nifi/nifi-1.10.0/conf/flow.xml.gz -g /path/to/nifi/nifi-1.15.2/conf/flow.xml.gz -s new_password -n /path/to/nifi/nifi-1.10.0/conf/nifi.properties -o /path/to/nifi/nifi-1.15.2/conf/nifi.properties -x
How do you change the algorithm and set the key at the same time?
Thanks
Issue can be resolved by following steps
Before migration if you don't have nifi.sensitive.props.key set, set it using following command ${NIFI_TOOLKIT_PAT}/bin/encrypt-config.sh -f /opt/nifi/nifi-current/data/flow.xml.gz -p ${NIFI_HOME}/conf/nifi.properties -s <NEW_KEY_TO_SET> -x
Once key is set upgrade nifi. Since in newer version algorithm is changed set it using command ${NIFI_HOME}/bin/nifi.sh set-sensitive-properties-algorithm <NEW_ALGORITHM>
Once algorithm set, encrypt again using command ${NIFI_TOOLKIT_PAT}/bin/encrypt-config.sh -f /opt/nifi/nifi-current/data/flow.xml.gz -p ${NIFI_HOME}/conf/nifi.properties -s <NEW_KEY_TO_SET> -x
Now you will get all compatible files with respect your latest version

Build to deploy guest on KVM hangs

I'm using Jenkins to automate the deploy of a virtual appliance. The first step is to build a standard CentOS 7 minimal vm in KVM. I wrote a short bash script to do this task which works when running locally on the KVM machine:
#!/bin/bash
#Variables
diskpath="/var/lib/libvirt/images/"
buildname=$(date +"%m-%d-%y-%H-%M")
vmextension=".dsk"
#Change to images directory
cd /var/lib/libvirt/images/
#Deploy VM with with kickstart file
sudo virt-install \
--name=$buildname \
--nographics \
--hvm \
--virt-type=kvm \
--file=$diskpath$buildname$vmextension \
--file-size=20 \
--nonsparse \
--vcpu=2 \
--ram=2048 \
--network bridge=br0 \
--os-type=linux \
--os-variant=generic \
--location=http://0.0.0.0/iso/ \
--initrd-inject /var/lib/libvirt/images/autobuild-ks.cfg \
--extra-args="ks=http://0.0.0.0/ks/autobuild-ks.cfg console=ttyS0"
(IP address i have changed for the purposes of security)
The ISO and the kickstart file are stored on another server and they can both be accessed via http for the purposes of making this script work. To be clear, the script does work.
The problem I have is, when I put this script into Jenkins as a build step, the script works; however, it hangs at the end after the OS has been installed and the kvm guest begins the shutdown process.
here is the kickstart file:
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use Network installation media
url --url=http://0.0.0.0/iso
# Use graphical install
#graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=gb --xlayouts='gb'
# System language
lang en_GB.UTF-8
# Network information
network --bootproto=dhcp --device=ens160 --ipv6=auto --activate
network --hostname=hostname.domain.com
# Root password
rootpw --iscrypted
taken_encryption_output_out_for_the_purposes_of_security
#Shutdown after installation
shutdown
# System services
services --enabled="chronyd"
# System timezone
timezone Europe/London --isUtc
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-
drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel
%packages
#^minimal
#core
chrony
kexec-tools
%end
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
%anaconda
pwpolicy root --minlen=6 --minquality=50 --notstrict --nochanges --
notempty
pwpolicy user --minlen=6 --minquality=50 --notstrict --nochanges --
notempty
pwpolicy luks --minlen=6 --minquality=50 --notstrict --nochanges --
notempty
%end
I suspect it's something to do with the shutdown option in the Kickstart file but unsure. When I ssh to the kvm server, I can see my newly created vm so the script does work but Jenkins hangs.
[root#sut-kvm01 ~]# virsh list --all
Id Name State
----------------------------------------------------
- 09-22-17-16-21 shut off
So far I have tried shutdown, reboot and obviously halt is default in the kickstart file and they have not worked for me either.
Any ideas how I can get the build to complete successfully? If it hangs, I can't move on to what will be build step number 2.
Help please :-)
Ok so I managed to figure out what the issue was. The issue was nothing to do with Jenkins or the script but rather to do with the kickstart file. In a nutshell, I was editing the wrong kickstart file. The file i was editing was the default kickstart file in the /root/ directory but that is not the same file that was being injected into memory by the script so the changes I made were having no effect.
Note to self - just because the script works, does not mean the answer to the problem isn't written in the script.

Cannot connect to amazon AWS EMR via the command line interface

I am running into problems when I am trying to run a mapreduce job on AWS via the command line. I have to perform a large set of steps (approx 100) that are all chained to each other. Since I am not looking forward to configuring that by hand with the AWS graphic interface, I am trying to get it done with the CLI.
However, even the most easy command does not work:
$ aws emr list-clusters
hostname 'elasticmapreduce.us-west-1.amazonaws.com' doesn't match u'us-west-1.elasticmapreduce.amazonaws.com'
On S3 my configurations seem to work fine, since this command creates the bucket without any problems:
$ aws s3 mb s3://randombigdatabucket
These are my configurations:
$ aws configure list
Name Value Type Location
---- ----- ---- --------
profile <not set> None None
access_key ****************fooo shared-credentials-file
secret_key ****************fooo shared-credentials-file
region us-west-1 config-file ~/.aws/config
I hope somebody can help me out with this one!
try to install AWS CLI v1.6.6 or later

opscenter can't connect to agents after enabling ssl

I'm setting up node-to-node encryption in AWS on ubuntu in a 3-node datastax enterprise 4.5.2 cluster. I followed these docs -
[1] -http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/sec/secNodeNodeEncryp.html
[2] - http://www.datastax.com/documentation/datastax_enterprise/4.5/datastax_enterprise/sec/secPrepareCerts.html
[3] - https://github.com/PatrickCallaghan/datastax-ssl-secure-cluster
[4] - http://datastax.com/documentation/opscenter/5.0/opsc/configure/opscEnableSSLpkg.html
I created the certs and the keystore. [1,2,3]
Added the certs to the truststore on each node [1,3]
edited cassandra.yaml to turn on node-to-node encryption (leaving client-to-node for another day) [1,3]
edited address.yaml to turn on encryption for datastax-agent [4]
restarted all nodes
'nodetool status' shows me all nodes are up normally. opscenter shows the nodes but gives the error message '0 of 3 agents are connected' What else needs to be done to allow opscenter to talk to the agents? Opsecenter is installed on one of the nodes, and it won't talk to the agent on the same box.
The opscenterd daemon failed to start correctly. examining /var/log/opscenter/opscenterd.log showed the following:
exceptions.ImportError: libssl.so.0.9.8: cannot open shared object file: No such file or directory
First, I tried the simple solution of linking
ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so.0.9.8 and
ln -s /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /lib/x86_64-linux-gnu/libscrypto.so.0.9.8
but that didn't work. The solution was to install libssl0.9.8 on the server running opscenter
$ sudo apt-get install libssl0.9.8
btw, this is opscenter 5.0.1.

Hadoop Ambari cannot confirm hosts

I tried to use Ambari to manage the installation and maintenance of the Hadoop cluster.
After I started ambari server, I use the web page to set up Hadoop cluster.
But at the 3rd step-- confirm hosts, the error shows below
And I check the log at /var/log/ambari-server, I found:
INFO:root:BootStrapping hosts ['qiao'] using /usr/lib/python2.6/site-packages/ambari_server cluster primary OS: redhat6 with user 'root' sshKey File /var/run/ambari-server/bootstrap/1/sshKey password File null using tmp dir /var/run/ambari-server/bootstrap/1 ambari: master; server_port: 8080; ambari version: 1.4.1.25
INFO:root:Executing parallel bootstrap
ERROR:root:ERROR: Bootstrap of host qiao fails because previous action finished with non-zero exit code (1)
INFO:root:Finished parallel bootstrap
Do you provide ssh rsa private key or paste it?
and from the place you are installing, make sure you can ssh to any hosts without typing any password.
If still the same error, try
ambari-server reset
ambari-server setup
Pls restart ambari-server
ambari-server restart
and then try accessing Ambari
It would work.
Make sure you can ssh to every single host on the list, including all master hosts.
To do this, ensure that Ambari host's .ssh/id_rsa.pub entry is included in every hosts' .ssh/authorized_keys file. Then ssh from Ambari's host to every single server - and check if it is asking for your password. You can use a tutorial like http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ to check if everything has been done properly.
You need to do the same on the Ambari host itself, if you added it to hosts list.

Resources