Skip to content

Commit b6c37ef

Browse files
committed
Openstack Swift support
1 parent df0aa83 commit b6c37ef

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

docs/openstack-integration.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
layout: global
3+
title: Accessing Openstack Swift storage from Spark
4+
---
5+
6+
# Accessing Openstack Swift storage from Spark
7+
8+
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://<container.service_provider>/path`. You will also need to set your Swift security credentials, through `SparkContext.hadoopConfiguration`.
9+
10+
#Configuring Hadoop to use Openstack Swift
11+
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.
12+
<h2>Hadoop 2.3.0 and above.</h2>
13+
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).
14+
To configure Hadoop to work with Swift one need to modify core-sites.xml of Hadoop and setup Swift FS.
15+
16+
<configuration>
17+
<property>
18+
<name>fs.swift.impl</name>
19+
<value>org.apache.hadoop.fs.swift.snative.SwiftNativeFileSystem</value>
20+
</property>
21+
</configuration>
22+
23+
24+
<h2>Configuring Spark - stand alone cluster</h2>
25+
You need to configure the compute-classpath.sh and add Hadoop classpath for
26+
27+
28+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/common/lib/*
29+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/hdfs/*
30+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/tools/lib/*
31+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/hdfs/lib/*
32+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/mapreduce/*
33+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/mapreduce/lib/*
34+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/yarn/*
35+
CLASSPATH = <YOUR HADOOP PATH>/share/hadoop/yarn/lib/*
36+
37+
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.
38+
List of mandatory parameters is : `fs.swift.service.<PROVIDER>.auth.url`, `fs.swift.service.<PROVIDER>.auth.endpoint.prefix`, `fs.swift.service.<PROVIDER>.tenant`, `fs.swift.service.<PROVIDER>.username`,
39+
`fs.swift.service.<PROVIDER>.password`, `fs.swift.service.<PROVIDER>.http.port`, `fs.swift.service.<PROVIDER>.http.port`, `fs.swift.service.<PROVIDER>.public`.
40+
Create core-sites.xml and place it under /spark/conf directory. Configure core-sites.xml with general Keystone parameters, for example
41+
42+
43+
<property>
44+
<name>fs.swift.service.<PROVIDER>.auth.url</name>
45+
<value>http://127.0.0.1:5000/v2.0/tokens</value>
46+
</property>
47+
<property>
48+
<name>fs.swift.service.<PROVIDER>.auth.endpoint.prefix</name>
49+
<value>endpoints</value>
50+
</property>
51+
<name>fs.swift.service.<PROVIDER>.http.port</name>
52+
<value>8080</value>
53+
</property>
54+
<property>
55+
<name>fs.swift.service.<PROVIDER>.region</name>
56+
<value>RegionOne</value>
57+
</property>
58+
<property>
59+
<name>fs.swift.service.<PROVIDER>.public</name>
60+
<value>true</value>
61+
</property>
62+
63+
We left with `fs.swift.service.<PROVIDER>.tenant`, `fs.swift.service.<PROVIDER>.username`, `fs.swift.service.<PROVIDER>.password`. The best way is to provide them to SparkContext in run time, which seems to be impossible yet.
64+
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
65+
66+
<property>
67+
<name>fs.swift.service.<PROVIDER>.tenant</name>
68+
<value>test</value>
69+
</property>
70+
<property>
71+
<name>fs.swift.service.<PROVIDER>.username</name>
72+
<value>tester</value>
73+
</property>
74+
<property>
75+
<name>fs.swift.service.<PROVIDER>.password</name>
76+
<value>testing</value>
77+
</property>
78+
<property>
79+
<h3> Usage </h3>
80+
Assume you have a Swift container `logs` with an object `data.log`. You can use `swift://` scheme to access objects from Swift.
81+
82+
val sfdata = sc.textFile("swift://logs.<PROVIDER>/data.log")
83+

0 commit comments

Comments
 (0)