Ottomata has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377350 )

Change subject: Add class to periodically run dfsadmin -fetchImage
......................................................................

Add class to periodically run dfsadmin -fetchImage

This will be used for Hadoop NameNode metadata backups

Change-Id: I00062ac74c8640e21545ad8b5aa2a46ac9a6f83a
---
A manifests/hadoop/namenode/backup.pp
1 file changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet/cdh 
refs/changes/50/377350/1

diff --git a/manifests/hadoop/namenode/backup.pp 
b/manifests/hadoop/namenode/backup.pp
new file mode 100644
index 0000000..936ffab
--- /dev/null
+++ b/manifests/hadoop/namenode/backup.pp
@@ -0,0 +1,37 @@
+# == Class cdh::hadoop::namenode::backup
+#
+# Installs a cron to periodically run hdfs dfsadmin -fetchImage $destination,
+# and another one to only remove any fetched images in $destination older than
+# $retention_days.
+#
+# $destination should be an existent directory; this class does not manage it.
+#
+class cdh::hadoop::namenode::backup(
+    $destination,
+    $retention_days = 30,
+    $hour           = undef,
+    $minute         = undef,
+    $month          = undef,
+    $monthday       = undef,
+) {
+    Class['cdh::hadoop'] -> Class['cdh::hadoop::namenode::backup']
+
+    cron { 'hadoop-namenode-backup-fetchimage':
+        command  => "/usr/bin/hdfs dfsadmin -fetchImage ${destination}",
+        user     => 'hdfs',
+        hour     => $hour,
+        minute   => $minute,
+        month    => $month,
+        monthday => $monthday,
+    }
+
+    # Delete files older than $retention_days.
+    cron { 'hadoop-namenode-backup-prune':
+        command => "/usr/bin/find ${destination} -mtime +${retension_days} 
-delete",
+        user     => 'hdfs',
+        hour     => $hour,
+        minute   => $minute,
+        month    => $month,
+        monthday => $monthday,
+    }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/377350
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I00062ac74c8640e21545ad8b5aa2a46ac9a6f83a
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet/cdh
Gerrit-Branch: master
Gerrit-Owner: Ottomata <ao...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to