Skip to content

jimbglenn/webHDFSClientBundle

 
 

Repository files navigation

webHDFSClientBundle

Description

webHDFSClientBundle provides a Symfony2 wrapper to the SimpleEnergy/php-WebHDFS code for interacting with HDFS from PHP. php-WebHDFS is a PHP client for WebHDFS.

Dependencies

Installation

Using composer

To install webHDFSClientBundle with Composer add the following to your composer.json file:

// composer.json
{
    // ...
    require: {
        // ...
        "jimbglenn/webHDFSClientBundle": "dev-master"
    }
}

Then, you can install with Composer's update command from your project root:

composer update jimbglenn/webHDFSClientBundle

Composer will download all the required files, and install them. Now you update AppKernel.php file and register the new bundle:

<?php
// in AppKernel::registerBundles()
    $bundles = array(
        // ...
        new jimbglenn\webHDFSClientBundle\webHDFSClientBundle(),
        // ...
        );

Setup config for your instance of Hadoop's WebHDFS api. In app/config/config.yml add the following section and fill in with your values:

# web hdfs client configuration for hadoop:
web_hdfs_client:
    webHDFS:
        serverName: devhadoop.localdomain
        port: 50070
        user: hadoop

Example:

From within a controller, you should be able to do get access to the web_hdfs_client:

$hdfs = $this->get('web_hdfs_cilent');

Usage

File and Directory Operations

Create and Write to a File

$hdfs = $this->get('web_hdfs_client');
$hdfs->create('user/hadoop-username/new-file.txt', 'local-file.txt');

About

A PHP client for WebHDFS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%