Accessing OpenStack Swift from Spark
Spark’s support for Hadoop InputFormat allows it to process data in OpenStack Swift using the
same URI formats as in Hadoop. You can specify a path in Swift as input through a
URI of the form
swift://container.PROVIDER/path. You will also need to set your
Swift security credentials, through
core-site.xml or via
Current Swift driver requires Swift to use Keystone authentication method.
Configuring Swift for Better Data Locality
Although not mandatory, it is recommended to configure the proxy server of Swift with
list_endpoints to have better data locality. More information is
The Spark application should include
For example, for Maven support, add the following to the
core-site.xml and place it inside Spark’s
There are two main categories of parameters that should to be configured: declaration of the
Swift driver and the parameters that are required by Keystone.
Configuration of Hadoop to use Swift File system achieved via
Additional parameters required by Keystone (v2.0) and should be provided to the Swift driver. Those
parameters will be used to perform authentication in Keystone to access Swift. The following table
contains a list of Keystone mandatory parameters.
PROVIDER can be any name.
||Keystone Authentication URL||Mandatory|
||Keystone endpoints prefix||Optional|
||Indicates if all URLs are public||Mandatory|
For example, assume
PROVIDER=SparkTest and Keystone contains user
tester with password
defined for tenant
core-site.xml should include:
fs.swift.service.PROVIDER.password contains sensitive information and keeping them in
core-site.xml is not always a good approach.
We suggest to keep those parameters in
core-site.xml for testing purposes when running Spark
For job submissions they should be provided via