diff --git a/core/pom.xml b/core/pom.xml index bab50f5ce2888..93dadafe57046 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -35,7 +35,11 @@ org.apache.hadoop hadoop-client - + + org.apache.hadoop + hadoop-openstack + + net.java.dev.jets3t jets3t diff --git a/docs/openstack-integration.md b/docs/openstack-integration.md index 42cd3067edf80..07f22b3f12b13 100644 --- a/docs/openstack-integration.md +++ b/docs/openstack-integration.md @@ -8,76 +8,85 @@ title: Accessing Openstack Swift storage from Spark Spark's file interface allows it to process data in Openstack Swift using the same URI formats that are supported for Hadoop. You can specify a path in Swift as input through a URI of the form `swift:///path`. You will also need to set your Swift security credentials, through `SparkContext.hadoopConfiguration`. #Configuring Hadoop to use Openstack Swift -Openstack Swift driver was merged in Hadoop verion 2.3.0 ([Swift driver](https://issues.apache.org/jira/browse/HADOOP-8545)) Users that wish to use previous Hadoop versions will need to configure Swift driver manually. -

Hadoop 2.3.0 and above.

-An Openstack Swift driver was merged into Haddop 2.3.0 . Current Hadoop driver requieres Swift to use Keystone authentication. There are additional efforts to support temp auth for Hadoop [Hadoop-10420](https://issues.apache.org/jira/browse/HADOOP-10420). +Openstack Swift driver was merged in Hadoop verion 2.3.0 ([Swift driver](https://issues.apache.org/jira/browse/HADOOP-8545)). Users that wish to use previous Hadoop versions will need to configure Swift driver manually. Current Swift driver requieres Swift to use Keystone authentication method. There are recent efforts to support also temp auth [Hadoop-10420](https://issues.apache.org/jira/browse/HADOOP-10420). To configure Hadoop to work with Swift one need to modify core-sites.xml of Hadoop and setup Swift FS. - - - fs.swift.impl - org.apache.hadoop.fs.swift.snative.SwiftNativeFileSystem - - + + + fs.swift.impl + org.apache.hadoop.fs.swift.snative.SwiftNativeFileSystem + + +#Configuring Swift +Proxy server of Swift should include `list_endpoints` middleware. More information available [here](https://github.com/openstack/swift/blob/master/swift/common/middleware/list_endpoints.py) -

Configuring Spark - stand alone cluster

-You need to configure the compute-classpath.sh and add Hadoop classpath for +#Configuring Spark +To use Swift driver, Spark need to be compiled with `hadoop-openstack-2.3.0.jar` distributted with Hadoop 2.3.0. +For the Maven builds, Spark's main pom.xml should include - - CLASSPATH = /share/hadoop/common/lib/* - CLASSPATH = /share/hadoop/hdfs/* - CLASSPATH = /share/hadoop/tools/lib/* - CLASSPATH = /share/hadoop/hdfs/lib/* - CLASSPATH = /share/hadoop/mapreduce/* - CLASSPATH = /share/hadoop/mapreduce/lib/* - CLASSPATH = /share/hadoop/yarn/* - CLASSPATH = /share/hadoop/yarn/lib/* - -Additional parameters has to be provided to the Hadoop from Spark. Swift driver of Hadoop uses those parameters to perform authentication in Keystone needed to access Swift. -List of mandatory parameters is : `fs.swift.service..auth.url`, `fs.swift.service..auth.endpoint.prefix`, `fs.swift.service..tenant`, `fs.swift.service..username`, -`fs.swift.service..password`, `fs.swift.service..http.port`, `fs.swift.service..http.port`, `fs.swift.service..public`. -Create core-sites.xml and place it under /spark/conf directory. Configure core-sites.xml with general Keystone parameters, for example - - - - fs.swift.service..auth.url - http://127.0.0.1:5000/v2.0/tokens - - - fs.swift.service..auth.endpoint.prefix - endpoints - - fs.swift.service..http.port - 8080 - - - fs.swift.service..region - RegionOne - - - fs.swift.service..public - true - - -We left with `fs.swift.service..tenant`, `fs.swift.service..username`, `fs.swift.service..password`. The best way is to provide them to SparkContext in run time, which seems to be impossible yet. -Another approach is to change Hadoop Swift FS driver to provide them via system environment variables. For now we provide them via core-sites.xml - - - fs.swift.service..tenant - test - - - fs.swift.service..username - tester - - - fs.swift.service..password - testing - - -

Usage

-Assume you have a Swift container `logs` with an object `data.log`. You can use `swift://` scheme to access objects from Swift. - - val sfdata = sc.textFile("swift://logs./data.log") + 2.3.0 + + + + org.apache.hadoop + hadoop-openstack + ${swift.version} + + +in addition, pom.xml of the `core` and `yarn` projects should include + + + org.apache.hadoop + hadoop-openstack + + + +Additional parameters has to be provided to the Swift driver. Swift driver will use those parameters to perform authentication in Keystone prior accessing Swift. List of mandatory parameters is : `fs.swift.service..auth.url`, `fs.swift.service..auth.endpoint.prefix`, `fs.swift.service..tenant`, `fs.swift.service..username`, +`fs.swift.service..password`, `fs.swift.service..http.port`, `fs.swift.service..http.port`, `fs.swift.service..public`, where `PROVIDER` is any name. `fs.swift.service..auth.url` should point to the Keystone authentication URL. + +Create core-sites.xml with the mandatory parameters and place it under /spark/conf directory. For example: + + + + fs.swift.service..auth.url + http://127.0.0.1:5000/v2.0/tokens + + + fs.swift.service..auth.endpoint.prefix + endpoints + + fs.swift.service..http.port + 8080 +
+ + fs.swift.service..region + RegionOne + + + fs.swift.service..public + true + + +We left with `fs.swift.service..tenant`, `fs.swift.service..username`, `fs.swift.service..password`. The best way to provide those parameters to SparkContext in run time, which seems to be impossible yet. +Another approach is to adapt Swift driver to obtain those values from system environment variables. For now we provide them via core-sites.xml. +Assume a tenant `test` with user `tester` was defined in Keystone, then the core-sites.xml shoud include: + + + fs.swift.service..tenant + test + + + fs.swift.service..username + tester + + + fs.swift.service..password + testing + +# Usage +Assume there exists Swift container `logs` with an object `data.log`. To access `data.log` from Spark the `swift://` scheme should be used. +For example: + + val sfdata = sc.textFile("swift://logs./data.log") diff --git a/pom.xml b/pom.xml index 86264d1132ec4..79cf5fdc23d01 100644 --- a/pom.xml +++ b/pom.xml @@ -132,6 +132,7 @@ 3.0.0 1.7.6 0.7.1 + 2.3.0 64m 512m @@ -584,6 +585,11 @@
+ + org.apache.hadoop + hadoop-openstack + ${swift.version} + org.apache.hadoop hadoop-yarn-api @@ -1024,6 +1030,11 @@ hadoop-client provided + + org.apache.hadoop + hadoop-openstack + provided + org.apache.hadoop hadoop-yarn-api diff --git a/yarn/pom.xml b/yarn/pom.xml index 6993c89525d8c..e58d8312f1a86 100644 --- a/yarn/pom.xml +++ b/yarn/pom.xml @@ -55,6 +55,10 @@ org.apache.hadoop hadoop-client + + org.apache.hadoop + hadoop-openstack + org.scalatest scalatest_${scala.binary.version}