Merge lp:~james-page/charms/precise/hadoop/storage-options into lp:~charmers/charms/precise/hadoop/trunk

Proposed by James Page
Status: Merged
Merged at revision: 27
Proposed branch: lp:~james-page/charms/precise/hadoop/storage-options
Merge into: lp:~charmers/charms/precise/hadoop/trunk
Diff against target: 80 lines (+27/-3)
3 files modified
config.yaml (+10/-0)
hooks/hadoop-common (+16/-2)
revision (+1/-1)
To merge this branch: bzr merge lp:~james-page/charms/precise/hadoop/storage-options
Reviewer Review Type Date Requested Status
Marc Cluet (community) Approve
Review via email: mp+108194@code.launchpad.net

Description of the change

This branch adds a storage option which allows all hadoop data to be stored
in a filesystem outside of root.

This supports using /mnt in ec2 (mainly)

To post a comment you must log in.
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Hi James. My only question would be whether or not we can just make it so the data is inaccessible if the value is changed, and can be made accessible again if it is changed back. "Lose all your data" sounds pretty scary.

Revision history for this message
James Page (james-page) wrote :

Clint

Guess you could just switch it back - description updated accordingly.

Revision history for this message
Marc Cluet (lynxman) wrote :

Change looks good, thank you very much James!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2012-04-24 13:23:02 +0000
3+++ config.yaml 2012-06-07 13:07:25 +0000
4@@ -142,3 +142,13 @@
5 description: |
6 The number of worker threads that for the http server. This is used for
7 map output fetching.
8+ hadoop.dir.base:
9+ type: string
10+ default: /var/lib/hadoop
11+ description: |
12+ The directory under which all other hadoop data is stored. Use this
13+ to take advantage of extra storage that might be avaliable.
14+ .
15+ You can change this in a running deployment but all existing data in
16+ HDFS will be inaccessible; you can of course switch it back if you
17+ do this by mistake.
18
19=== modified file 'hooks/hadoop-common'
20--- hooks/hadoop-common 2012-03-27 12:00:13 +0000
21+++ hooks/hadoop-common 2012-06-07 13:07:25 +0000
22@@ -159,7 +159,7 @@
23 # Purge existing configuration
24 rm -f $dir/1*-dfs.*
25 config_element "dfs.name.dir" \
26- "/var/lib/hadoop/cache/hadoop/dfs/name" > \
27+ "`config-get hadoop.dir.base`/cache/hadoop/dfs/name" > \
28 $dir/10-dfs.name.dir
29 config_element "dfs.namenode.handler.count" \
30 "`config-get dfs.namenode.handler.count`" > \
31@@ -196,13 +196,25 @@
32 dir=`dotdee --dir /etc/hadoop/conf.juju/core-site.xml`
33 config_basic $dir
34 rm -f $dir/1*-*
35- config_element "hadoop.tmp.dir" "/var/lib/hadoop/cache/\${user.name}" > \
36+ config_element "hadoop.tmp.dir" "`config-get hadoop.dir.base`/cache/\${user.name}" > \
37 $dir/10-hadoop.tmp.dir
38 config_element "io.file.buffer.size" "`config-get io.file.buffer.size`" > \
39 $dir/11-io.file.buffer.size
40 dotdee --update /etc/hadoop/conf.juju/core-site.xml || true
41 }
42
43+configure_tmp_dir_perms() {
44+ dir=`config-get hadoop.dir.base`
45+ # Make sure the directory exists
46+ mkdir -p $dir/cache/hadoop
47+ # We don't want to do this recursively since we may be reinstalling, in which case
48+ # users have their own cache/<username> directories which shouldn't be stolen
49+ chown root:hadoop $dir $dir/cache $dir/cache/hadoop
50+ # Ensure group write on this directory or we can start namenode/datanode
51+ chmod 775 $dir/cache/hadoop
52+ chmod 1777 $dir/cache
53+}
54+
55 configure_role_relation () {
56 dir=`dotdee --dir /etc/hadoop/conf.juju/core-site.xml`
57 juju-log "Configuring service unit relation $1..."
58@@ -368,6 +380,7 @@
59 install_base_packages
60 install_optional_packages
61 configure_hadoop
62+ configure_tmp_dir_perms
63 ;;
64 jobtracker-relation-joined)
65 case $mapred_role in
66@@ -541,6 +554,7 @@
67 upgrade-charm|config-changed)
68 install_optional_packages
69 configure_hadoop
70+ configure_tmp_dir_perms
71 conditional_restart # only restart if pertinent config has changed!
72 open_ports
73 ;;
74
75=== modified file 'revision'
76--- revision 2012-04-24 13:23:02 +0000
77+++ revision 2012-06-07 13:07:25 +0000
78@@ -1,1 +1,1 @@
79-15
80+16

Subscribers

People subscribed via source and target branches

to all changes: