daemon ( $daemon_type, $opt )

Create a new bootstrap action which lets you configure Hadoop’s daemons. The options are written to the hadoop-user-env.sh file.

Access

public static

Parameters

Parameter

Type

Required

Description

$daemon_type

string

Required

The Hadoop daemon to configure.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • HeapSize - integer - Optional - The requested heap size of the daemon, in megabytes.
  • CLIOptions - string - Optional - Additional Java command line arguments to pass to the daemon.
  • Replace - boolean - Optional - Whether or not the file should be replaced. A value of true will replace the existing configuration file. A value of false will append the options to the configuration file.

Returns

Type

Description

array

A configuration set to be provided when running a job flow.

Source

Method defined in utilities/hadoopbootstrap.class.php | Toggle source view (26 lines) | View on GitHub

public static function daemon($daemon_type, $opt = null)
{
    if (!$opt) $opt = array();
    $args = array();

    foreach ($opt as $key => $value)
    {
        switch ($key)
        {
            case 'HeapSize':
                $args[] = '--' . $daemon_type . '-heap-size=' . $value;
                break;
            case 'CLIOptions':
                $args[] = '--' . $daemon_type . '-opts="' . $value . '"';
                break;
            case 'Replace':
                if ((is_string($value) && $value === 'true') || (is_bool($value) && $value === true))
                {
                    $args[] = '--replace';
                }
                break;
        }
    }

        return self::script_runner('s3://' . self::$region . '.elasticmapreduce/bootstrap-actions/configure-daemons', $args);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback