WebHDFS REST API proxy
webhdfs-proxy is a naive proxy layer for Hadoop WebHDFS REST API, which can be used to mock WebHDFS API requests in the tests or help to replace/migrate existing HDFS data storage (migration to S3, GridFS or custom storage etc.).
Storage specific logic is implemented in storage middleware. webhdfs-proxy itself implements basic requests validation, parsing and redirects simulation, and utilities for handling WehbHDFS API requests and responses.
Supported WebHDFS REST API operations (Hadoop 2.4.x compatible) at the moment are:
Install module:
npm install webhdfs-proxy --save
Basic middleware skeleton:
var WebHDFSProxy = require'webhdfs-proxy'; WebHDFSProxycreateServer path: '/webhdfs/v1' validate: true http: port: 80 https: port: 443 key: '/path/to/key' cert: '/path/to/cert' // Pass error to WebHDFS REST API user if err return nexterr; switch operation case 'open': // Implement operation logic here return next; break; case 'create': // Implement operation logic here return next; break; case 'mkdirs': // Implement operation logic here return next'Internal error'; break; if err console.log'WebHDFS proxy server was not created: ' + errmessage; return; // Proxy server was successfully created ;
For extended usage and implementing your own storage middleware, please see example middlewares.
Running tests:
npm test
MIT