EclairJS / eclairjs-node

Node.js API for Apache Spark with Remote Client
Apache License 2.0
356 stars 38 forks source link

The eclairjs-node and eclairjs-nashorn repositories have been merged into a new one called eclairjs and all future work is done there.

EclairJS Node

EclairJS Node provides Node.js language bindings for Apache Spark.

Learn more about the larger EclairJS project.

Installation

$ npm install eclairjs

EclairJS Node requires Node 0.12 or higher and also requires a running instance of EclairJS Nashorn.

Supported Spark versions can be found in the Versions section below.

Example

EclairJS Node's api mirrors the Spark api. Here is the classic word count example:

var eclairjs = require('eclairjs');

var spark = new eclairjs();

var sc = new spark.SparkContext("local[*]", "Simple Word Count");

var textFile = sc.textFile('foo.txt');

var words = textFile.flatMap(function(sentence) {
  return sentence.split(" ");
});

var wordsWithCount = words.mapToPair(function(word, Tuple2) {
  return new Tuple2(word, 1);
}, [eclairjs.Tuple2]);

var reducedWordsWithCount = wordsWithCount.reduceByKey(function(value1, value2) {
  return value1 + value2;
});

reducedWordsWithCount.collect().then(function(results) {
  console.log('Word Count:', results);
  sc.stop();
});

Try It

EclairJS Node provides a Docker container that contains all of its dependencies on Dockerhub.

The Docker image supports the latest released version of EclairJS Node and may not work with master. You can simply check out the appropriate branch (git checkout branch-0.7 for example).

docker pull eclairjs/minimal-gateway
docker run -p 8888:8888 eclairjs/minimal-gateway

After retrieving Docker's IP address (docker-machine ip), you will need to set two environment variables:

export JUPYTER_HOST=??.??.??.?? (your docker ip)
export JUPYTER_PORT=8888

Now you can run the Word count example:

node --harmony examples/rddtop10.js ./dream.txt

You can learn more about the Docker container here. You can also try out EclairJS in Jupyter notebooks running under the IBM Bluemix Cloud.

Documentation

Community

Deploy

You can choose to either deploy using Docker (Using the Docker Container) or manually build and setup your own environment (Build and Package).

Progress

Spark Feature EclairJS Node Status
RDD Partial Support
SQL/DataFrames Partial Support
Streaming Partial Support
ml Partial Support
mllib Partial Support
GraphX Unsupported

Refer to the API Documentation for a list of what is currently implemented. Please note as new APIs are implemented for EclairJS Node they will be added to the master branch.

Contributions are always welcome via pull requests.

Versions

Our goal is to keep the EclairJS master branch up to date with the latest version of Spark. When new versions of Spark require code changes, we create a separate branch. The table below shows what is available now.

EclairJS Version/Tag Apache Spark Version
0.1 1.5.1
0.2 - 0.7 1.6.0
0.8 (master) 2.0.0