AC::MrGamoo::MySelf - customize mrgamoo to your own environment
emacs /myperldir/Local/MrGamoo/MySelf.pm copy. paste. edit. use lib '/myperldir'; my $m = AC::MrGamoo::D->new( class_myself => 'Local::MrGamoo::MySelf', );
provide functions to override default behavior. you may define any or all of the following functions.
return a unique identity for this mrgamoo instance. typically, something similar to the server hostname.
sub my_server_id { return 'mrm@' . hostname(); }
return the name of the local datacenter. mrgamoo will use this to determine which systems are local (same datacenter) and which are remote (different datacenter), and will tune various behaviors accordingly.
sub my_datacenter { my($domain) = hostname() =~ /^[\.]+\.(.*)/; return $domain; }
Note: map/reduce jobs are extremely network intensive. it is not recommended to spread your servers out. you really want them all plugged into one big switch. one big fast switch.
return information about the various networks this server has.
sub my_network_info { my $public_ip = inet_ntoa(scalar gethostbyname(hostname())); my $privat_ip = inet_ntoa(scalar gethostbyname('internal-' . hostname())); return [ # use this IP for communication with servers this datacenter (same natdom) { ip => $privat_ip, natdom => my_datacenter() }, # otherwise use this IP { ip => $public_ip }, ] }
inialization function called at startup. typically used to lookup hostanmes, IP addresses, and such and store them in variables to make the above functions faster.
my $HOSTNAME; my $DOMAIN; sub init { $HOSTNAME = hostname(); ($DOMAIN) = $HOSTNAME =~ /^[\.]+\.(.*)/; }
none. you write this yourself.
AC::MrGamoo
You!
To install AC::MrGamoo, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AC::MrGamoo
CPAN shell
perl -MCPAN -e shell install AC::MrGamoo
For more information on module installation, please visit the detailed CPAN module installation guide.