other/java/hdfs3/README.md
Hadoop FileSystem implementation for SeaweedFS, compatible with Hadoop 3.x.
mvn clean install
This project includes two types of tests:
These tests verify configuration handling and initialization logic without requiring a running SeaweedFS instance:
mvn test -Dtest=SeaweedFileSystemConfigTest
These tests verify actual FileSystem operations against a running SeaweedFS instance.
Start SeaweedFS with default ports:
# Terminal 1: Start master
weed master
# Terminal 2: Start volume server
weed volume -master=localhost:9333
# Terminal 3: Start filer
weed filer -master=localhost:9333
Verify services are running:
# Enable integration tests
export SEAWEEDFS_TEST_ENABLED=true
# Run all tests
mvn test
# Run specific test
mvn test -Dtest=SeaweedFileSystemTest
Integration tests can be configured via environment variables or system properties:
SEAWEEDFS_TEST_ENABLED: Set to true to enable integration tests (default: false)To test against a different SeaweedFS instance, modify the test code or use Hadoop configuration:
conf.set("fs.seaweed.filer.host", "your-host");
conf.setInt("fs.seaweed.filer.port", 8888);
conf.setInt("fs.seaweed.filer.port.grpc", 18888);
The test suite covers:
Configuration & Initialization
File Operations
Directory Operations
Metadata Operations
Copy the built JAR to your Hadoop classpath:
cp target/seaweedfs-hadoop3-client-*.jar $HADOOP_HOME/share/hadoop/common/lib/
Configure core-site.xml:
<configuration>
<property>
<name>fs.seaweedfs.impl</name>
<value>seaweed.hdfs.SeaweedFileSystem</value>
</property>
<property>
<name>fs.seaweed.filer.host</name>
<value>localhost</value>
</property>
<property>
<name>fs.seaweed.filer.port</name>
<value>8888</value>
</property>
<property>
<name>fs.seaweed.filer.port.grpc</name>
<value>18888</value>
</property>
<!-- Optional: Replication configuration with three priority levels:
1) If set to non-empty value (e.g. "001") - uses that value
2) If set to empty string "" - uses SeaweedFS filer's default replication
3) If not configured (property not present) - uses HDFS replication parameter
-->
<!-- <property>
<name>fs.seaweed.replication</name>
<value>001</value>
</property> -->
</configuration>
Use SeaweedFS with Hadoop commands:
hadoop fs -ls seaweedfs://localhost:8888/
hadoop fs -mkdir seaweedfs://localhost:8888/test
hadoop fs -put local.txt seaweedfs://localhost:8888/test/
For CI environments, tests can be run in two modes:
Configuration Tests Only (default, no SeaweedFS required):
mvn test -Dtest=SeaweedFileSystemConfigTest
Full Integration Tests (requires SeaweedFS):
# Start SeaweedFS in CI environment
# Then run:
export SEAWEEDFS_TEST_ENABLED=true
mvn test
If you see "Skipping test - SEAWEEDFS_TEST_ENABLED not set":
export SEAWEEDFS_TEST_ENABLED=true
Ensure SeaweedFS is running and accessible:
curl http://localhost:8888/
Verify the gRPC port is accessible:
# Should show the port is listening
netstat -an | grep 18888
When adding new features, please include: