Environment Variables
You can use environment variables instead of arguments for weed.
For example:
instead of weed master -port 5000 -mdir /tmp -volumePreallocate -ip.bind 0.0.0.0 you can use
export IP_BIND=0.0.0.0
export PORT=5000
export MDIR=/tmp
export VOLUMEPREALLOCATE=true # or export VOLUMEPREALLOCATE=
weed master
Weed prefix
For v, logtostderr, stderrthreshold, vmoudle, options, logdir, alsologtostderr, log_backtrace_at , and config_dir you have to use WEED_ as prefix for environment variable like this WEED_CONFIG_DIR=/tmp
Configuration File Settings
For configuration file settings (like filer stores, replication settings, etc.), you must use the WEED_ prefix with dots (.) replaced by underscores (_).
For example, the filer.toml configuration:
[redis2]
enabled = true
address = "localhost:6379"
password = "secret"
database = 0
Becomes these environment variables:
WEED_REDIS2_ENABLED=true
WEED_REDIS2_ADDRESS=localhost:6379
WEED_REDIS2_PASSWORD=secret
WEED_REDIS2_DATABASE=0
S3 Admin Credentials
For S3 API server authentication, see the dedicated S3 Credentials page which covers:
- Configuration file setup (highest priority)
- Filer configuration (medium priority)
- Environment variables as fallback (lowest priority)
- AWS standard environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - Complete authentication examples and troubleshooting
Docker
You can set environment variables easily in Docker:
docker run --name master -d -p 9333:9333 -p 19333:19333 \
-e MDIR="/data" -e PORT="9333" \
chrislusf/seaweedfs:latest \
master
Docker Compose with Environment Variables
version: '3.9'
services:
master:
image: chrislusf/seaweedfs:latest
ports:
- 9333:9333
- 19333:19333
environment:
IP_BIND: 0.0.0.0
MDIR: /data
PORT: 9333
VOLUMEPREALLOCATE: 'true'
# or `VOLUMEPREALLOCATE:`
entrypoint: weed
command: master
filer:
image: chrislusf/seaweedfs:latest
ports:
- 8888:8888
environment:
# ... other filer environment variables
entrypoint: weed
command: filer -master=master:9333
s3:
image: chrislusf/seaweedfs:latest
ports:
- 8333:8333
environment:
AWS_ACCESS_KEY_ID: s3admin
AWS_SECRET_ACCESS_KEY: s3secret
entrypoint: weed
command: s3 -filer=filer:8888
depends_on:
- filer
Filer Metadata Store Configuration
The filer supports multiple metadata storage backends. You can configure them using environment variables instead of a filer.toml file.
Redis Configuration
Basic Redis (redis2)
version: '3.9'
services:
redis:
image: redis:7-alpine
ports:
- 6379:6379
command: redis-server --requirepass your_password
master:
image: chrislusf/seaweedfs:latest
ports:
- 9333:9333
command: master
volume:
image: chrislusf/seaweedfs:latest
ports:
- 8080:8080
command: volume -mserver=master:9333
depends_on:
- master
filer:
image: chrislusf/seaweedfs:latest
ports:
- 8888:8888
environment:
# Enable Redis as metadata store
- WEED_REDIS2_ENABLED=true
- WEED_REDIS2_ADDRESS=redis:6379
- WEED_REDIS2_PASSWORD=your_password
- WEED_REDIS2_DATABASE=0
# Optional: TLS configuration
- WEED_REDIS2_ENABLE_TLS=false
# Disable default leveldb2
- WEED_LEVELDB2_ENABLED=false
command: filer -master=master:9333
depends_on:
- master
- volume
- redis
Redis Sentinel
WEED_REDIS2_SENTINEL_ENABLED=true
WEED_REDIS2_SENTINEL_ADDRESSES=sentinel1:26379,sentinel2:26379,sentinel3:26379
WEED_REDIS2_SENTINEL_MASTERNAME=mymaster
WEED_REDIS2_SENTINEL_USERNAME=
WEED_REDIS2_SENTINEL_PASSWORD=secret
WEED_REDIS2_SENTINEL_DATABASE=0
WEED_LEVELDB2_ENABLED=false
Redis Cluster
WEED_REDIS_CLUSTER2_ENABLED=true
WEED_REDIS_CLUSTER2_ADDRESSES=redis1:6379,redis2:6379,redis3:6379
WEED_REDIS_CLUSTER2_PASSWORD=secret
WEED_REDIS_CLUSTER2_READONLY=false
WEED_REDIS_CLUSTER2_ROUTEBYLATENCY=false
WEED_LEVELDB2_ENABLED=false
MySQL/MariaDB Configuration
version: '3.9'
services:
mysql:
image: mysql:8
ports:
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=seaweedfs
- MYSQL_USER=seaweedfs
- MYSQL_PASSWORD=secret
master:
image: chrislusf/seaweedfs:latest
ports:
- 9333:9333
command: master
volume:
image: chrislusf/seaweedfs:latest
ports:
- 8080:8080
command: volume -mserver=master:9333
depends_on:
- master
filer:
image: chrislusf/seaweedfs:latest
ports:
- 8888:8888
environment:
# MySQL configuration
- WEED_MYSQL_ENABLED=true
- WEED_MYSQL_HOSTNAME=mysql
- WEED_MYSQL_PORT=3306
- WEED_MYSQL_DATABASE=seaweedfs
- WEED_MYSQL_USERNAME=seaweedfs
- WEED_MYSQL_PASSWORD=secret
- WEED_MYSQL_CONNECTION_MAX_IDLE=5
- WEED_MYSQL_CONNECTION_MAX_OPEN=75
- WEED_MYSQL_CONNECTION_MAX_LIFETIME_SECONDS=600
- WEED_MYSQL_INTERPOLATEPARAMS=true
# Disable default leveldb2
- WEED_LEVELDB2_ENABLED=false
command: filer -master=master:9333
depends_on:
- master
- volume
- mysql
PostgreSQL Configuration
WEED_POSTGRES_ENABLED=true
WEED_POSTGRES_HOSTNAME=postgres
WEED_POSTGRES_PORT=5432
WEED_POSTGRES_DATABASE=seaweedfs
WEED_POSTGRES_USERNAME=seaweedfs
WEED_POSTGRES_PASSWORD=secret
WEED_POSTGRES_SSLMODE=disable
WEED_POSTGRES_CONNECTION_MAX_IDLE=5
WEED_POSTGRES_CONNECTION_MAX_OPEN=75
WEED_POSTGRES_CONNECTION_MAX_LIFETIME_SECONDS=600
WEED_LEVELDB2_ENABLED=false
MongoDB Configuration
WEED_MONGODB_ENABLED=true
WEED_MONGODB_URI=mongodb://mongodb:27017
WEED_MONGODB_DATABASE=seaweedfs
WEED_MONGODB_USERNAME=seaweedfs
WEED_MONGODB_PASSWORD=secret
WEED_LEVELDB2_ENABLED=false
Etcd Configuration
WEED_ETCD_ENABLED=true
WEED_ETCD_SERVERS=etcd1:2379,etcd2:2379,etcd3:2379
WEED_ETCD_KEY_PREFIX=seaweedfs.
WEED_ETCD_TIMEOUT=3s
WEED_LEVELDB2_ENABLED=false
Important Notes
-
Only one store can be enabled: Make sure to disable the default
leveldb2store when using an external metadata store:WEED_LEVELDB2_ENABLED=false -
Available stores: To see all available filer stores and their configuration options, run:
weed scaffold -config=filer -
Data migration: Changing stores doesn't automatically migrate existing data. Apply these configurations to new installations or migrate data manually.
-
Array values: For configuration options that accept arrays (like Redis cluster addresses), use comma-separated values:
WEED_REDIS_CLUSTER2_ADDRESSES=host1:6379,host2:6379,host3:6379
Introduction
API
Configuration
- Replication
- Store file with a Time To Live
- Failover Master Server
- Erasure coding for warm storage
- 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
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
FUSE Mount
WebDAV
Cloud Drive
- Cloud Drive Benefits
- Cloud Drive Architecture
- Configure Remote Storage
- Mount Remote Storage
- Cache Remote Storage
- Cloud Drive Quick Setup
- Gateway to Remote Object Storage
AWS S3 API
- S3 Credentials
- Amazon S3 API
- S3 Conditional Operations
- S3 CORS
- S3 Object Lock and Retention
- S3 Object Versioning
- AWS CLI with SeaweedFS
- s3cmd with SeaweedFS
- rclone with SeaweedFS
- restic with SeaweedFS
- nodejs with Seaweed S3
- S3 API Benchmark
- S3 API FAQ
- S3 Bucket Quota
- S3 API Audit log
- S3 Nginx Proxy
- Docker Compose for S3
Server-Side Encryption
AWS IAM
Machine Learning
HDFS
- Hadoop Compatible File System
- run Spark on SeaweedFS
- run HBase on SeaweedFS
- run Presto 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
Advanced
- Large File Handling
- Optimization
- Volume Management
- Tiered Storage
- Cloud Tier
- Cloud Monitoring
- Load Command Line Options from a file
- SRV Service Discovery
- Volume Files Structure