Code Monkey home page Code Monkey logo

docker-hive-spark's Introduction

Hive Metastore + Spark Thriftserver preconfigured docker

This docker can be used as a sandbox for testing flamy. It is required to run the second part of flamy's demo.

Building image

Run this command to build the docker image (might require sudo rights)

docker build -t docker-hive-spark .

Running the image

Then run this from the flamy-demo repository's base directory

docker run --rm -e USER=`id -u -n` -e USER_ID=`id -u` -it -v `pwd`/data:/data/hive -p 127.0.0.1:9083:9083 -p 127.0.0.1:4040:4040 -p 127.0.0.1:10000:10000 docker-hive-spark

It will start a docker that will automatically:

  • expose a running Metastore on the port 9083
  • expose a running Spark ThriftServer (similar to HiveServer2) on port 10000
  • expose the Spark GUI to follow job progress on port 4040
  • start a beeline terminal

In case you wonder what the part with the USER and USER_ID is about: it is a kind of docker-voodoo-danse to prevent docker writing stuff as root in the external volume.

Accessing Amazon s3

This docker has Hive and Spark preconfigured to support Hive tables on Amazon s3. You must pass your credentials to the docker by adding these options to the above docker run command. Of course you shall replace the dots with the correct values.

-e AWS_ACCESS_KEY_ID=... -e AWS_SECRET_ACCESS_KEY=...

Next, you can create a table with

CREATE EXTERNAL TABLE my_db.mytable (columns ...) 
LOCATION "s3a://my_bucket/my/table/path"

Please note the EXTERNAL keyword which is highly recommended if you don't want to lose the data when the table is dropped (s3 doesn't implemented hdfs's Trash...). Please also note that the location starts with s3a, and not s3 or s3n.

docker-hive-spark's People

Contributors

furcypin avatar anselmevignon avatar ir73 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.