Merge lp:~admcleod/charms/trusty/apache-hadoop-plugin/hadoop-upgrade into lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk

Proposed by Andrew McLeod
Status: Needs review
Proposed branch: lp:~admcleod/charms/trusty/apache-hadoop-plugin/hadoop-upgrade
Merge into: lp:~bigdata-dev/charms/trusty/apache-hadoop-plugin/trunk
Diff against target: 149 lines (+115/-1)
4 files modified
README.md (+27/-1)
actions.yaml (+10/-0)
actions/hadoop-upgrade (+70/-0)
resources.yaml (+8/-0)
To merge this branch: bzr merge lp:~admcleod/charms/trusty/apache-hadoop-plugin/hadoop-upgrade
Reviewer Review Type Date Requested Status
Juju Big Data Development Pending
Review via email: mp+275418@code.launchpad.net

Description of the change

Added hadoop-upgrade action, modified resources.yaml

To post a comment you must log in.

Unmerged revisions

107. By Andrew McLeod

updated README.md

106. By Andrew McLeod

trivial text modifications

105. By Andrew McLeod

hadoop upgrade actions additions etc

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.md'
2--- README.md 2015-10-06 18:29:02 +0000
3+++ README.md 2015-10-22 16:48:34 +0000
4@@ -25,9 +25,35 @@
5 juju deploy apache-pig pig
6 juju add-relation plugin pig
7
8+
9+## Upgrading
10+
11+This charm includes the hadoop-upgrade action which will download, untar and
12+upgrade the hadoop software to the specified version. This should be used in
13+conjunction with the hadoop-pre-upgrade and hadoop-post-upgrade actions on the
14+namenode (apache-hadoop-hdfs-master) which stops any hadoop related processes on
15+the cluster before allowing the upgrade to proceed.
16+
17+If different
18+versions of hadoop are running on related services, the cluster will not
19+function correctly.
20+
21+The rollback param specifies whether to recreate (overwrite)
22+the hadoop software or simply recreate the /usr/lib/hadoop symlink.
23+
24+Syntax for this action is:
25+
26+ juju action do datanode/0 hadoop-upgrade version=X.X.X rollback=false
27+
28+This action will upgrade the unit extended status.
29+You can also get action results with:
30+
31+ juju action fetch --wait 0 action-id
32+
33+
34 ## Benchmarking
35
36- You can perform a terasort benchmark, in order to gauge performance of your environment:
37+You can perform a terasort benchmark, in order to gauge performance of your environment:
38
39 $ juju action do plugin/0 terasort
40 Action queued with id: cbd981e8-3400-4c8f-8df1-c39c55a7eae6
41
42=== modified file 'actions.yaml'
43--- actions.yaml 2015-06-08 20:05:37 +0000
44+++ actions.yaml 2015-10-22 16:48:34 +0000
45@@ -36,3 +36,13 @@
46 description: How many tasks to run per jvm. If set to -1, there is no limit.
47 type: integer
48 default: 1
49+hadoop-upgrade:
50+ description: upgrade (or roll back) hadoop to specified version
51+ params:
52+ version:
53+ type: string
54+ description: destination hadoop version X.X.X
55+ rollback:
56+ type: boolean
57+ description: true or false - defaults to false
58+ required: [version, rollback]
59
60=== added file 'actions/hadoop-upgrade'
61--- actions/hadoop-upgrade 1970-01-01 00:00:00 +0000
62+++ actions/hadoop-upgrade 2015-10-22 16:48:34 +0000
63@@ -0,0 +1,70 @@
64+#!/bin/bash
65+export SAVEPATH=$PATH
66+. /etc/environment
67+export PATH=$PATH:$SAVEPATH
68+export JAVA_HOME
69+
70+current_hadoop_ver=`/usr/lib/hadoop/bin/hadoop version|head -n1|awk '{print $2}'`
71+new_hadoop_ver=`action-get version`
72+cpu_arch=`lscpu|grep -i arch|awk '{print $2}'`
73+rollback=`action-get rollback`
74+source .venv/bin/activate
75+
76+
77+if [ "$new_hadoop_ver" == "$current_hadoop_ver" ] ; then
78+ action-set result="Same version already installed, aborting"
79+ action-fail "Same version already installed"
80+ exit 1
81+fi
82+
83+if [ "${rollback}" == "True" ] ; then
84+ if [ -d /usr/lib/hadoop-${new_hadoop_ver} ] ; then
85+ rm /usr/lib/hadoop
86+ ln -s /usr/lib/hadoop-${new_hadoop_ver} /usr/lib/hadoop
87+ if [ -d /usr/lib/hadoop-${current_hadoop_ver}/logs ] ; then
88+ mv /usr/lib/hadoop-${current_hadoop_ver}/logs /usr/lib/hadoop/
89+ fi
90+ fi
91+ action-set newhadoop.rollback="successfully rolled back"
92+ status-set active "Ready - rollback to ${new_hadoop_ver} complete"
93+ exit 0
94+fi
95+
96+status-set maintenance "Fetching hadoop-${new_hadoop_ver}-${cpu_arch}"
97+juju-resources fetch hadoop-${new_hadoop_ver}-${cpu_arch}
98+if [ ! $? -eq 0 ] ; then
99+ action-set newhadoop.fetch="fail"
100+ exit 1
101+fi
102+action-set newhadoop.fetch="success"
103+
104+status-set maintenance "Verifying hadoop-${new_hadoop_ver}-${cpu_arch}"
105+juju-resources verify hadoop-${new_hadoop_ver}-${cpu_arch}
106+if [ ! $? -eq 0 ] ; then
107+ action-set newhadoop.verify="fail"
108+ exit 1
109+fi
110+action-set newhadoop.verify="success"
111+
112+new_hadoop_path=`juju-resources resource_path hadoop-${new_hadoop_ver}-${cpu_arch}`
113+if [ -h /usr/lib/hadoop ] ; then
114+ rm /usr/lib/hadoop
115+fi
116+
117+mv /usr/lib/hadoop/ /usr/lib/hadoop-${current_hadoop_ver}
118+ln -s /usr/lib/hadoop-${current_hadoop_ver}/ /usr/lib/hadoop
119+current_hadoop_path=hadoop-${current_hadoop_ver}
120+
121+status-set maintenance "Extracting hadoop-${new_hadoop_ver}-${cpu_arch}"
122+tar -zxvf ${new_hadoop_path} -C /usr/lib/
123+if [ $? -eq 0 ] ; then
124+ if [ -h /usr/lib/hadoop ] ; then
125+ rm /usr/lib/hadoop
126+ fi
127+ ln -s /usr/lib/hadoop-${new_hadoop_ver} /usr/lib/hadoop
128+fi
129+if [ -d ${current_hadoop_path}/logs ] ; then
130+ mv ${current_hadoop_path}/logs ${new_hadoop_path}/
131+fi
132+action-set result="complete"
133+status-set active "Ready - hadoop version ${new_hadoop_ver} installed"
134
135=== modified file 'resources.yaml'
136--- resources.yaml 2015-10-06 18:29:28 +0000
137+++ resources.yaml 2015-10-22 16:48:34 +0000
138@@ -28,3 +28,11 @@
139 url: https://s3.amazonaws.com/jujubigdata/apache/x86_64/hadoop-2.4.1-a790d39.tar.gz
140 hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b672
141 hash_type: sha256
142+ hadoop-2.4.1-x86_64:
143+ url: https://s3.amazonaws.com/jujubigdata/apache/x86_64/hadoop-2.4.1-a790d39.tar.gz
144+ hash: a790d39baba3a597bd226042496764e0520c2336eedb28a1a3d5c48572d3b672
145+ hash_type: sha256
146+ hadoop-2.7.1-x86_64:
147+ url: http://mirrors.ukfast.co.uk/sites/ftp.apache.org/hadoop/common/hadoop-2.7.1/hadoop-2.7.1.tar.gz
148+ hash: 991dc34ea42a80b236ca46ff5d207107bcc844174df0441777248fdb6d8c9aa0
149+ hash_type: sha256

Subscribers

People subscribed via source and target branches