Skip to content

Instantly share code, notes, and snippets.

@dougm
Created January 31, 2009 00:42
Show Gist options
  • Save dougm/55377 to your computer and use it in GitHub Desktop.
Save dougm/55377 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
#hadoop-metric-gen.pl
use strict;
#generate some test data for hadoop-collectd
#http://hadoop.apache.org/core/docs/current/quickstart.html
#svn co http://svn.apache.org/repos/asf/hadoop/core/trunk hadoop-core-trunk
#cd hadoop-core-trunk
#ant jar examples
my $hadoop = "./bin/hadoop";
chdir "$ENV{HOME}/hadoop-core-trunk" unless -x $hadoop;
my $in = shift || "input";
my $out = shift || "output";
my $dir = -d 'build' ? 'build' : '.';
my(@cmds) = (
"$hadoop fs -rmr $in",
"$hadoop fs -put conf $in",
"$hadoop fs -rmr $out",
"$hadoop jar $dir/hadoop-*-examples.jar grep $in $out 'dfs[a-z.]+'",
"$hadoop fs -get $out $out",
"rm -rf ./$out",
);
while (1) {
for my $cmd (@cmds) {
print "$cmd\n";
system $cmd;
}
sleep int rand 600;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment