You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/openstack-integration.md
+76-67Lines changed: 76 additions & 67 deletions
Original file line number
Diff line number
Diff line change
@@ -8,76 +8,85 @@ title: Accessing Openstack Swift storage from Spark
8
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
9
10
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).
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. 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).
14
12
To configure Hadoop to work with Swift one need to modify core-sites.xml of Hadoop and setup Swift FS.
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)
23
23
24
-
<h2>Configuring Spark - stand alone cluster</h2>
25
-
You need to configure the compute-classpath.sh and add Hadoop classpath for
24
+
#Configuring Spark
25
+
To use Swift driver, Spark need to be compiled with `hadoop-openstack-2.3.0.jar` distributted with Hadoop 2.3.0.
26
+
For the Maven builds, Spark's main pom.xml should include
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`,
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")
28
+
<swift.version>2.3.0</swift.version>
29
+
30
+
31
+
<dependency>
32
+
<groupId>org.apache.hadoop</groupId>
33
+
<artifactId>hadoop-openstack</artifactId>
34
+
<version>${swift.version}</version>
35
+
</dependency>
36
+
37
+
in addition, pom.xml of the `core` and `yarn` projects should include
38
+
39
+
<dependency>
40
+
<groupId>org.apache.hadoop</groupId>
41
+
<artifactId>hadoop-openstack</artifactId>
42
+
</dependency>
43
+
44
+
45
+
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.<PROVIDER>.auth.url`, `fs.swift.service.<PROVIDER>.auth.endpoint.prefix`, `fs.swift.service.<PROVIDER>.tenant`, `fs.swift.service.<PROVIDER>.username`,
46
+
`fs.swift.service.<PROVIDER>.password`, `fs.swift.service.<PROVIDER>.http.port`, `fs.swift.service.<PROVIDER>.http.port`, `fs.swift.service.<PROVIDER>.public`, where `PROVIDER` is any name. `fs.swift.service.<PROVIDER>.auth.url` should point to the Keystone authentication URL.
47
+
48
+
Create core-sites.xml with the mandatory parameters and place it under /spark/conf directory. For example:
We left with `fs.swift.service.<PROVIDER>.tenant`, `fs.swift.service.<PROVIDER>.username`, `fs.swift.service.<PROVIDER>.password`. The best way to provide those parameters to SparkContext in run time, which seems to be impossible yet.
72
+
Another approach is to adapt Swift driver to obtain those values from system environment variables. For now we provide them via core-sites.xml.
73
+
Assume a tenant `test` with user `tester` was defined in Keystone, then the core-sites.xml shoud include:
74
+
75
+
<property>
76
+
<name>fs.swift.service.<PROVIDER>.tenant</name>
77
+
<value>test</value>
78
+
</property>
79
+
<property>
80
+
<name>fs.swift.service.<PROVIDER>.username</name>
81
+
<value>tester</value>
82
+
</property>
83
+
<property>
84
+
<name>fs.swift.service.<PROVIDER>.password</name>
85
+
<value>testing</value>
86
+
</property>
87
+
# Usage
88
+
Assume there exists Swift container `logs` with an object `data.log`. To access `data.log` from Spark the `swift://` scheme should be used.
89
+
For example:
90
+
91
+
val sfdata = sc.textFile("swift://logs.<PROVIDER>/data.log")
0 commit comments