31/10
2014
Wallogit.com
2017 © Pedro Peláez
composer require mrferos/zf2-webhdfs:dev-master
A simple ZF2 module providing an Abstract Factory to create instances of php-WebHDFS, (*1)
Copy the provided example config file into config/autoload, (*2)
cp vendor/zf2-webhdfs/config/mrfwebhdfs.global.config.php.dist config/autoload/mrfwebhdfs.global.config.php
And edit the file with your settings:, (*3)
<?php
return array(
'WebHDFSExample' => array(
'username' => 'mrferos',
'host' => 'localhost',
'port' => 50070
)
);
Calling "WebHDFSExample" from the service manager will return an instance of the WebHDFS class with your provided configurations., (*4)
$webhdfs = $serviceManager->get('WebHDFSExample');
If you have multiple WebHDFS enpoints, you can define each like so:, (*5)
<?php
return array(
'WebHDFSExample1' => array(
'username' => 'mrferos',
'host' => 'localhost',
'port' => 50070
),
'WebHDFSExample2' => array(
'username' => 'mrferos',
'host' => 'localhost',
'port' => 50070
)
'WebHDFSExample3' => array(
'username' => 'mrferos',
'host' => 'localhost',
'port' => 50070
)
);
And call them in the same way,, (*6)
$webhdfs1 = $serviceManager->get('WebHDFSExample1');
$webhdfs2 = $serviceManager->get('WebHDFSExample2');
$webhdfs3 = $serviceManager->get('WebHDFSExample3');