Git Product home page Git Product logo

docker-spark's Introduction

docker-spark

A standalone container with Apache Spark 1.6 on Ubuntu

Usage

Fetch image:

$ docker pull tchaumeny/spark

Running Spark master in a container:

$ docker run --name spark-master -dit tchaumeny/spark
$ docker exec spark-master spark-1.6.0/sbin/start-master.sh

Running a Spark worker in a container:

$ docker run --name spark-worker --link spark-master -dit tchaumeny/spark
$ docker exec spark-worker spark-1.6.0/sbin/start-slave.sh spark://spark-master:7077

Using Python shell on master container:

$ docker exec -it spark-master spark-1.6.0/bin/pyspark

Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /__ / .__/\_,_/_/ /_/\_\   version 1.6.0
      /_/

Using Python version 2.7.6 (default, Jun 22 2015 17:58:13)
SparkContext available as sc, SQLContext available as sqlContext.
>>> from operator import add
>>> from random import random
>>>
>>> N = 10**7
>>>
>>> def sample(p):
...     x, y = random(), random()
...     return 1 if x*x + y*y < 1 else 0
... 
>>> count = sc.parallelize(xrange(N)).map(sample).reduce(add)

>>> print("Pi is roughly %f" % (4.0 * count / N))
Pi is roughly 3.141773

docker-spark's People

Contributors

tchaumeny avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.