Solve Media > AC-MrGamoo-1 > AC::MrGamoo::MySelf

Download:
AC-MrGamoo-1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

AC::MrGamoo::MySelf - customize mrgamoo to your own environment

SYNOPSIS ^

    emacs /myperldir/Local/MrGamoo/MySelf.pm
    copy. paste. edit.

    use lib '/myperldir';
    my $m = AC::MrGamoo::D->new(
        class_myself        => 'Local::MrGamoo::MySelf',
    );

DESCRIPTION ^

provide functions to override default behavior. you may define any or all of the following functions.

my_server_id

return a unique identity for this mrgamoo instance. typically, something similar to the server hostname.

    sub my_server_id {
        return 'mrm@' . hostname();
    }

my_datacenter

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.

my_network_info

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 },
        ]
    }

init

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 =~ /^[\.]+\.(.*)/;
    }

BUGS ^

none. you write this yourself.

SEE ALSO ^

    AC::MrGamoo

AUTHOR ^

    You!
syntax highlighting: