Roman Jurkov > Net-MCMP-0.08 > Net::MCMP

Download:
Net-MCMP-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.08   Source  

NAME ^

Net::MCMP - Mod Cluster Management Protocol client

SYNOPSIS ^

    use Net::MCMP;
    my $mcmp = Net::MCMP->new( { uri => 'http://127.0.0.1:6666' } );
    $mcmp->config(
        {
            JvmRoute => 'MyJVMRoute',
            Host     => 'localhost',
            Port     => '3000',
            Type     => 'http',
            Context  => '/myContext',
            Alias    => 'Vhost',
        }
    );

    $mcmp->enable_app(
        {
            JvmRoute => 'MyJVMRoute',
            Alias    => 'Vhost',
            Context  => '/myContext'
        }
    );

    $mcmp->remove_app(
        {
            JvmRoute => 'MyJVMRoute',
            Alias    => 'SomeHost',
            Context  => '/cluster'
        }
    );

    $mcmp->remove_route(
        {
            JvmRoute => 'MyJVMRoute',
        }
    );

    $mcmp->status(
        {
            JvmRoute => 'MyJVMRoute',
            Load     => 55,
        }
    );

    $mcmp->disable_app(
        {
            JvmRoute => 'MyJVMRoute',
            Alias    => 'SomeHost',
            Context  => '/cluster'
        }
    );

    $mcmp->stop_app(
        {
            JvmRoute => 'MyJVMRoute',
            Alias    => 'SomeHost',
            Context  => '/cluster'
        }
    );

DESCRIPTION ^

Net::MCMP is an implementation of the Mod Cluster Management Protocol (MCMP). Net::MCMP uses LWP::UserAgent and HTTP::Request for its communication with mod_cluster.

MCMP stands for Mod Cluster Management Protocol and is a method of adding proxy settings dynamically, as appose to creating static apache rules.

Official documentation of MCMP can be found here: https://community.jboss.org/wiki/Mod-ClusterManagementProtocol

USAGE ^

Net::MCMP->new(\%args)

Creates a new MCMP object, and returns a Net::MCMP object representing that connection.

        my $mcmp = Net::MCMP({ uri => 'http://127.0.0.1:6666', debug => 0});

%args can contain:

$mcmp->config(\%conig)

Sends configuration for a node or set of nodes

If a low-level protocol error or unexpected local error occurs, we die with an error message.

        $mcmp->config({
                JvmRoute            => "MyAppNode1",
                Balancer            => 'MyApp',
                Domain              => 'MyApp',
                StickySessionCookie => 'myapp_session',
                StickySessionPath   => 'myapp',
                Host                => '192.168.0.101',
                Port                => '3000',
                Type                => 'http',
                Context             => '/myapp',
                Alias               => "MyApp", 
        });

%config can contain:

$mcmp->ping(\%ping)

Request a ping to httpd or node

        my $ping_resp = $mcmp->ping(
                {
                        JvmRoute => 'MyAppNode1',
                }
        );
        
        # SAMPLE $ping_response
        #$VAR1 = {
        #    'id' => '-540134453',
        #    'JvmRoute' => 'MyJVMRoute',
        #    'State' => 'OK',
        #    'Type' => 'PING-RSP'
        #};

$mcmp->enable_app(\%enable_app)

Sends request to enable newly configured Node

        $mcmp->enable_app(
                {
                        JvmRoute => 'MyAppNode1',
                        Alias    => 'MyApp',
                        Context  => '/myapp'
                }
        );

$mcmp->status(\%status)

Sends load metrics for configured node, number from 1-100

        my $status_response = $mcmp->status(
                {
                        JvmRoute => 'MyAppNode1',
                        Load    => 99,
                }
        );

        # SAMPLE $status_response
        # $VAR1 = {
        #     'State' => 'OK',
        #     'JvmRoute' => 'MyJVMRoute',
        #     'id' => '-297586570',
        #     'Type' => 'STATUS-RSP'
        # };

$mcmp->disable_app(\%disable_app)

Apache should not create new session for this webapp, but still continue serving existing session on this node

        $mcmp->disable_app(
                {
                        JvmRoute => 'MyAppNode1',
                        Alias    => 'MyApp',
                        Context  => '/myapp'
                }
        );

$mcmp->stop_app(\%stop_app)

New requests for this webapp should not be sent to this node.

        $mcmp->stop_app(
                {
                        JvmRoute => 'MyAppNode1',
                        Alias    => 'MyApp',
                        Context  => '/myapp'
                }
        );

$mcmp->remove_app(\%remove_app)

Remove registered context from registered node.

        $mcmp->remove_app(
                {
                        JvmRoute => 'MyAppNode1',
                        Alias    => 'MyApp',
                        Context  => '/myapp'
                }
        );

$mcmp->enable_route(\%enable_route)

Sends request to enable all of the registered contexts in a selected node

        $mcmp->enable_route(
                {
                        JvmRoute => 'MyAppNode1',
                }
        );

$mcmp->disable_route(\%disable_route)

Sends request to disable all of the registered contexts in a selected node

        $mcmp->disable_route(
                {
                        JvmRoute => 'MyAppNode1',
                }
        );

$mcmp->stop_route(\%stop_route)

Sends request to stop all of the registered contexts in a selected node

        $mcmp->stop_route(
                {
                        JvmRoute => 'MyAppNode1',
                }
        );

$mcmp->remove_route(\%remove_route)

Sends request to remove registered node

        $mcmp->remove_route(
                {
                        JvmRoute => 'MyAppNode1',
                }
        );

$mcmp->debug()

Sends request to receive unparsed DEBUG content of mod_cluster

        my $debug_response = $mcmp->debug();

$mcmp->info()

Sends request to receive unparsed INFO content of mod_cluster

        my $info_response = $mcmp->info();

$mcmp->has_errors()

Checks if a remote call returned any errors

        my $has_errors = $mcmp->has_errors();

$mcmp->error()

Error string that was returned from mod_cluster handler.

        my $error_string = $mcmp->error();

SUPPORT ^

For samples/tutorials, take a look at provided tests in t/ in the distribution directory.

Please report all bugs via github at https://github.com/winfinit/Net-MCMP

AUTHOR ^

Roman Jurkov (winfinit) <winfinit@cpan.org>

COPYRIGHT ^

Copyright (c) 2014 the Net::MCMP "AUTHORS" as listed above.

LICENSE ^

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: