2017 © Pedro Peláez
 

library php-webhdfs

PHP WebHDFS, forked from https://github.com/simpleenergy/php-WebHDFS

image

dingfudata/php-webhdfs

PHP WebHDFS, forked from https://github.com/simpleenergy/php-WebHDFS

  • Friday, October 14, 2016
  • by xfight
  • Repository
  • 0 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 29 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

php-WebHDFS

Description

php-WebHDFS is a PHP client for WebHDFS., (*1)

Dependencies

Install via composer

composer require simpleenergy/php-webhdfs

Usage

File and Directory Operations

Create and Write to a File

hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->create('user/hadoop-username/new-file.txt', 'local-file.txt');

Create and write content directly to a file

hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->createWithData('user/hadoop-username/new-file.txt', 'content');

Append to a File

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->append('user/hadoop-username/file-to-append-to.txt', 'local-file.txt');

Concat File(s)

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->concat('user/hadoop-username/concatenated-file.txt', '/test/file1,/test/file2,/test/file3');

Open and Read a File

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->open('user/hadoop-username/file.txt');

Make a Directory

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->mkdirs('user/hadoop-username/new/directory/structure');
$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->createSymLink('user/hadoop-username/file.txt', '/user/hadoop-username/symlink-to-file.txt');
````

#### Rename a File/Directory
```php
$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->rename('user/hadoop-username/file.txt', '/user/hadoop-username/renamed-file.txt');
````

#### Delete a File/Directory
```php
hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->delete('user/hadoop-username/file.txt');

Status of a File/Directory

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->getFileStatus('user/hadoop-username/file.txt');

List a Directory

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->listStatus('user/hadoop-username/');

Other File System Operations

Get Content Summary of a Directory

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->getContentSummary('user/hadoop-username/');

Get File Checksum

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->getFileChecksum('user/hadoop-username/file.txt');

Get Home Directory

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->getHomeDirectory();

Set Permission

$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->setPermission('user/hadoop-username/file.txt', '777');
````

#### Set Owner
```php
$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->setOwner('user/hadoop-username/file.txt', 'other-user');
````

#### Set Replication Factor
```php
$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$hdfs->setReplication('user/hadoop-username/file.txt', '2');
````

#### Set Access or Modification Time
```php
$hdfs = new WebHDFS('mynamenode.hadoop.com', '50070', 'hadoop-username');
$response = $hdfs->setTimes('user/hadoop-username/file.txt');

The Versions

14/10 2016

dev-master

9999999-dev

PHP WebHDFS, forked from https://github.com/simpleenergy/php-WebHDFS

  Sources   Download

Unknown

The Requires

  • php >=5.4.0
  • ext-curl *