Table of Contents
Current recommended way for Hadoop to access SeaweedFS is via SeaweedFS Hadoop Compatible File System, which is the most efficient way with the client directly accessing filer for metadata and accessing volume servers for file content.
However, the downside is that you need to add a SeaweedFS jar to classpath, and change some Hadoop settings.
HDFS Access SeaweedFS via S3 connector
The S3A connector (hadoop-aws) points at the SeaweedFS S3 gateway. It ships with Hadoop distributions, so no SeaweedFS jar is needed.
Tested with Spark 4.0.3 (spark-4.0.3-bin-hadoop3, bundled Hadoop 3.4.1) on JDK 17. The hadoop-aws jar must match the Hadoop version bundled in Spark. For this build that is hadoop-aws-3.4.1.jar plus the AWS SDK v2 bundle bundle-2.24.6.jar, both found under share/hadoop/tools/lib/ of a Hadoop 3.4.1 distribution.
Configuration
Point S3A at the SeaweedFS S3 gateway (default port 8333):
fs.s3a.endpoint=http://localhost:8333
fs.s3a.path.style.access=true
fs.s3a.connection.ssl.enabled=false
Create the bucket before writing:
$ aws --endpoint-url http://localhost:8333 s3 mb s3://test
Credentials
A SeaweedFS S3 gateway started without an identity config allows anonymous access. Use the anonymous provider:
fs.s3a.aws.credentials.provider=org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider
To require credentials, start the gateway with a static identity config, e.g. s3.json:
{
"identities": [
{
"name": "spark",
"credentials": [
{ "accessKey": "sparkkey", "secretKey": "sparksecret" }
],
"actions": ["Admin", "Read", "Write", "List", "Tagging"]
}
]
}
$ weed server -s3 -s3.config=s3.json ...
Then use the simple provider with those keys:
fs.s3a.aws.credentials.provider=org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider
fs.s3a.access.key=sparkkey
fs.s3a.secret.key=sparksecret
Example
$ bin/spark-shell \
--master 'local[2]' \
--jars /path/to/hadoop-aws-3.4.1.jar,/path/to/bundle-2.24.6.jar \
--conf spark.hadoop.fs.s3a.endpoint=http://localhost:8333 \
--conf spark.hadoop.fs.s3a.path.style.access=true \
--conf spark.hadoop.fs.s3a.connection.ssl.enabled=false \
--conf spark.hadoop.fs.s3a.aws.credentials.provider=org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider
...
scala> val df = Seq((10,"x"),(20,"y"),(30,"z")).toDF("id","label")
scala> df.write.mode("overwrite").parquet("s3a://test/spark-s3a/data")
scala> val back = spark.read.parquet("s3a://test/spark-s3a/data")
scala> back.count()
res: Long = 3
scala> back.orderBy("id").show(false)
+---+-----+
|id |label|
+---+-----+
|10 |x |
|20 |y |
|30 |z |
+---+-----+
The write lands in the bucket as spark-s3a/data/_SUCCESS plus the snappy parquet part files.
Packaged spark job
Example pom.xml properties for a job compiled against Spark 4.0.3:
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.13.16</scala.version>
<spark.version>4.0.3</spark.version>
<hadoop.version>3.4.1</hadoop.version>
<spark.pom.scope>compile</spark.pom.scope>
</properties>
And set the S3A configuration in your code:
SparkSession spark = SparkSession.builder()
.master("local[*]")
.config("spark.eventLog.enabled", "false")
.appName("SparkDemoFromS3")
.getOrCreate();
Configuration conf = spark.sparkContext().hadoopConfiguration();
conf.set("fs.s3a.endpoint", "http://localhost:8333");
conf.set("fs.s3a.path.style.access", "true");
conf.set("fs.s3a.connection.ssl.enabled", "false");
// anonymous access
conf.set("fs.s3a.aws.credentials.provider", "org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider");
// or, with a static identity:
// conf.set("fs.s3a.aws.credentials.provider", "org.apache.hadoop.fs.s3a.SimpleAWSCredentialsProvider");
// conf.set("fs.s3a.access.key", "sparkkey");
// conf.set("fs.s3a.secret.key", "sparksecret");
Dataset<Row> df = spark.read().parquet("s3a://test/spark-s3a/data");
System.out.println(df.count());
df.write().mode("overwrite").parquet("s3a://test/testcc/t2");
Introduction
- Quick Start with weed mini
- Simplest S3 Bucket and User Setup
- Components
- Blob Store Architecture
- Getting Started
- Production Setup
- A typical step‐by‐step example
- Benchmarks
- FAQ
- Applications
API
Configuration
- Replication
- Store file with a Time To Live
- Failover Master Server
- Erasure coding for warm storage
- EC Bitrot Detection
- Server Startup via Systemd
- Environment Variables
Filer
- Filer Setup
- Directories and Files
- File Operations Quick Reference
- Data Structure for Large Files
- Filer Data Encryption
- Filer Commands and Operations
- Filer JWT Use
- TUS Resumable Uploads
Filer Stores
- Filer Cassandra Setup
- Filer Redis Setup
- Super Large Directories
- Path-Specific Filer Store
- Choosing a Filer Store
- Customize Filer Store
Management
Advanced Filer Configurations
- Migrate to Filer Store
- Add New Filer Store
- Filer Store Replication
- Filer Active Active cross cluster continuous synchronization
- Filer as a Key-Large-Value Store
- Path Specific Configuration
- Filer Change Data Capture
- Filer Operation Serialization
FUSE Mount
- Mount on Windows
- FIO benchmark
- fstab and systemd mount
- POSIX Compliance
- Distributed POSIX Locks
- P2P reading in weed mount
- Mount over the Internet
WebDAV
SFTP Server
Cloud Drive
- Cloud Drive Benefits
- Cloud Drive Architecture
- Configure Remote Storage
- Azure Blob Storage Authentication
- Mount Remote Storage
- Cache Remote Storage
- Cloud Drive Quick Setup
- Gateway to Remote Object Storage
AWS S3 API
- Amazon S3 API
- Supported APIs vs Minio
- S3 Lifecycle
- S3 Lifecycle vs Volume TTL
- S3 Conditional Operations
- S3 CORS
- S3 Object Lock and Retention
- S3 Object Versioning
- S3 RenameObject
- S3 API Benchmark
- S3 API FAQ
- S3 Bucket Quota
- S3 Rate Limiting
- S3 API Audit log
- S3 Nginx Proxy
- Docker Compose for S3
S3 Table Bucket
- S3 Table Bucket
- S3 Table Bucket Commands
- S3 Tables Security
- SeaweedFS Iceberg Catalog
- Iceberg REST Catalog API
- Iceberg Table Maintenance
- SeaweedFS Lance Catalog
- Lance Maintenance Worker
Iceberg Integrations
- Spark Iceberg Integration
- Trino Iceberg Integration
- Dremio Iceberg Integration
- DuckDB Iceberg Integration
- Doris Iceberg Integration
- RisingWave Iceberg Integration
- Lakekeeper Iceberg Integration
Lance Integrations
S3 Authentication & IAM
- S3 Configuration - Start Here
- S3 Credentials (
-s3.config) - OIDC Integration (
-s3.iam.config) - Kubernetes ServiceAccount Authentication (IRSA-style)
- S3 Policy Variables
- S3 Policy Conditions
- S3 Bucket Policies
- Amazon IAM API
- AWS IAM CLI
- weed shell - Shell IAM Commands
Server-Side Encryption
S3 Client Tools
- AWS CLI with SeaweedFS
- s3cmd with SeaweedFS
- rclone with SeaweedFS
- restic with SeaweedFS
- nodejs with Seaweed S3
Machine Learning
HDFS
- Hadoop Compatible File System
- run Spark on SeaweedFS
- run HBase on SeaweedFS
- Run Trino on SeaweedFS
- Hadoop Benchmark
- HDFS via S3 connector
Replication and Backup
- Async Replication to another Filer [Deprecated]
- Async Backup
- Async Filer Metadata Backup
- Async Replication to Cloud [Deprecated]
- Kubernetes Backups and Recovery with K8up
Metadata Change Events
Messaging
- Structured Data Lake with SMQ and SQL
- Seaweed Message Queue
- SQL Queries on Message Queue
- SQL Quick Reference
- PostgreSQL-compatible Server weed db
- Pub-Sub to SMQ to SQL
- Kafka to Kafka Gateway to SMQ to SQL
Use Cases
Operations
- System Metrics
- weed shell
- Data Backup
- Deployment to Kubernetes and Minikube
- Helm Chart Recipes
- Deployment with seaweed-up
Rust Volume Server
Advanced
- Large File Handling
- Optimization
- Optimization for Many Small Buckets
- Volume Management
- Tiered Storage
- Cloud Tier
- Cloud Monitoring
- Load Command Line Options from a file
- SRV Service Discovery
- Volume Files Structure
Security
- Security Overview
- Security Configuration
- Cryptography and FIPS Compliance
- Run Blob Storage on Public Internet