### Quick Installation Script
Source: https://docs.rustfs.com/installation/linux/quick-start.html
This script downloads and executes the RustFS installation script for Single Node Single Disk (SNSD) mode.
```bash
curl -O https://rustfs.com/install_rustfs.sh && bash install_rustfs.sh
```
--------------------------------
### TLS Configuration Example
Source: https://docs.rustfs.com/installation/docker
Example of mounting certificates for TLS configuration.
```bash
-v /path/to/certs:/certs \
-e RUSTFS_TLS_PATH=/certs \
```
--------------------------------
### Example Configuration
Source: https://docs.rustfs.com/developer/sdk/python.html
Configuration details for connecting to a RustFS deployment.
```text
Endpoint: http://192.168.1.100:9000
AccessKey: rustfsadmin
SecretKey: rustfssecret
```
--------------------------------
### SDK Installation
Source: https://docs.rustfs.com/developer/sdk/javascript.html
Install the required AWS SDK v3 modules with NPM.
```bash
npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner
```
--------------------------------
### Frontend Upload Example
Source: https://docs.rustfs.com/developer/sdk/javascript.html
An example demonstrating how to use presigned URLs for direct file uploads from a browser using HTML and JavaScript.
```html
```
--------------------------------
### Install Boto3
Source: https://docs.rustfs.com/developer/sdk/python.html
Commands to install the Boto3 library using pip within a virtual environment.
```bash
python3 -m venv venv
source venv/bin/activate
pip install boto3
```
--------------------------------
### Command Line Parameter Method for Configuration
Source: https://docs.rustfs.com/installation/docker
Example of configuring RustFS using command-line parameters.
```bash
--address :9000 \
--server-domains example.com \
--access-key rustfsadmin \
--secret-key rustfsadmin \
--console-enable \
```
--------------------------------
### Start and Enable RustFS Service
Source: https://docs.rustfs.com/installation/linux/single-node-multiple-disk.html
Enable the RustFS service to start automatically on boot and start it immediately. Verify the service status and check network ports to confirm it is running correctly. Monitor log files for any errors.
```bash
sudo systemctl enable --now rustfs
systemctl status rustfs
netstat -ntpl
tail -f /var/logs/rustfs/rustfs*.log
```
--------------------------------
### Start Observability Services
Source: https://docs.rustfs.com/installation/docker
Command to start RustFS along with observability services (Grafana, Prometheus, etc.) using Docker Compose.
```bash
docker compose --profile observability up -d
```
--------------------------------
### Environment Variable Method for Configuration
Source: https://docs.rustfs.com/installation/docker
Example of configuring RustFS using environment variables.
```bash
-e RUSTFS_ADDRESS=:9000 \
-e RUSTFS_SERVER_DOMAINS=example.com \
-e RUSTFS_ACCESS_KEY=rustfsadmin \
-e RUSTFS_SECRET_KEY=rustfsadmin \
-e RUSTFS_CONSOLE_ENABLE=true \
```
--------------------------------
### Start Only RustFS Service
Source: https://docs.rustfs.com/installation/docker
Command to start only the `rustfs-server` service using Docker Compose.
```bash
docker compose -f docker-compose.yml up -d rustfs
```
--------------------------------
### Create Bucket
Source: https://docs.rustfs.com/developer/sdk/javascript.html
Create a new bucket.
```javascript
import { CreateBucketCommand } from "@aws-sdk/client-s3";
await s3.send(new CreateBucketCommand({ Bucket: "my-bucket" }));
console.log("Bucket created");
```
--------------------------------
### Enable and Start RustFS Service
Source: https://docs.rustfs.com/installation/linux/single-node-single-disk.html
Enable the RustFS service to start automatically on boot and start it immediately. This command combines enabling and starting the service.
```bash
sudo systemctl enable --now rustfs
```
--------------------------------
### Run RustFS Container (Basic)
Source: https://docs.rustfs.com/installation/docker/index.html
Starts a RustFS container in detached mode, mapping ports and mounting a data volume. This is a basic setup for local testing.
```bash
docker run -d \
--name rustfs_local \
-p 9000:9000 \
-p 9001:9001 \
-v /mnt/rustfs/data:/data \
rustfs/rustfs:latest \
/data
```
--------------------------------
### Initializing the Client
Source: https://docs.rustfs.com/developer/sdk/javascript.html
Initialize the S3Client for RustFS.
```javascript
import { S3Client } from "@aws-sdk/client-s3";
import { NodeHttpHandler } from "@smithy/node-http-handler";
const s3 = new S3Client({
endpoint: "http://192.168.1.100:9000", // RustFS endpoint
region: "us-east-1", // Any value is accepted
credentials: {
accessKeyId: "rustfsadmin",
secretAccessKey: "rustfssecret",
},
forcePathStyle: true, // Must be enabled for RustFS compatibility
requestHandler: new NodeHttpHandler({
connectionTimeout: 3000,
socketTimeout: 5000,
}),
});
```
--------------------------------
### HOSTS Configuration Example
Source: https://docs.rustfs.com/installation/linux/multiple-node-multiple-disk.html
Example of modifying the /etc/hosts file to set identical, sequential hostnames for a RustFS cluster.
```bash
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.1 node1
192.168.1.2 node2
192.168.1.3 node3
192.168.1.4 node4
```
--------------------------------
### Upload using curl
Source: https://docs.rustfs.com/developer/sdk/python.html
Example command to upload a file using curl with a presigned PUT URL.
```bash
curl -X PUT --upload-file hello.txt "http://..."
```
--------------------------------
### Create Bucket
Source: https://docs.rustfs.com/developer/sdk/rust.html
Example of how to create a new bucket using the RustFS client.
```rust
match rustfs_client
.create_bucket()
.bucket("your-bucket-name")
.send()
.await
{
Ok(_) => {
println!("Bucket created successfully");
}
Err(e) => {
println!("Error creating bucket: {:?}", e);
return Err(e.into());
}
}
```
--------------------------------
### List Buckets
Source: https://docs.rustfs.com/developer/sdk/rust.html
Example of how to list all buckets using the RustFS client.
```rust
match rustfs_client.list_buckets().send().await {
Ok(res) => {
println!("Total buckets number is {:?}", res.buckets().len());
for bucket in res.buckets() {
println!("Bucket: {:?}", bucket.name());
}
}
Err(e) => {
println!("Error listing buckets: {:?}", e);
return Err(e.into());
}
}
```
--------------------------------
### Execute RustFS Java Demo
Source: https://docs.rustfs.com/developer/sdk/java.html
Executes the RustFS Java S3 example application.
```bash
java -cp target/rustfs-java-s3-demo-1.0-SNAPSHOT.jar com.example.RustfsS3Example
```
--------------------------------
### Download and Install RustFS Binary
Source: https://docs.rustfs.com/upgrade-scale/availability-and-resiliency.html
Download and install a specific version of the RustFS binary package. Ensure the version matches the existing cluster to maintain compatibility.
```bash
wget https://github.com/rustfs/rustfs/releases/download/1.0.0-alpha.67/rustfs-linux-x86_64-musl-latest.zip
unzip rustfs-linux-x86_64-musl-latest.zip
chmod +x rustfs
mv rustfs /usr/local/bin/
```
--------------------------------
### Remount Disks and Start RustFS Service
Source: https://docs.rustfs.com/troubleshooting/driver.html
Remount all disks using the updated configuration and then start the RustFS service. Verify that all disks are mounted correctly.
```bash
mount -a
systemctl start rustfs
```
```bash
df -h | grep /mnt/disk
```
--------------------------------
### Basic Configuration Combination
Source: https://docs.rustfs.com/installation/docker
A basic Docker run command for RustFS.
```bash
docker run -d \
-p 9000:9000 \
-p 9001:9001 \
-v /mnt/data:/data \
rustfs/rustfs:latest \
/data
```
--------------------------------
### Download Object
Source: https://docs.rustfs.com/developer/sdk/javascript.html
Download a file from a bucket.
```javascript
import { GetObjectCommand } from "@aws-sdk/client-s3";
import { writeFile } from "fs/promises";
const response = await s3.send(
new GetObjectCommand({ Bucket: "my-bucket", Key: "hello.txt" })
);
const streamToBuffer = async (stream) => {
const chunks = [];
for await (const chunk of stream) chunks.push(chunk);
return Buffer.concat(chunks);
};
const buffer = await streamToBuffer(response.Body);
await writeFile("downloaded.txt", buffer);
console.log("File downloaded");
```
--------------------------------
### Start and Enable RustFS Service
Source: https://docs.rustfs.com/installation/linux/multiple-node-multiple-disk.html
This command starts the RustFS service and configures it to start automatically on system boot.
```bash
sudo systemctl enable --now rustfs
```
--------------------------------
### Start RustFS Service
Source: https://docs.rustfs.com/troubleshooting/node.html
Command to start the RustFS server service using systemd.
```bash
systemctl start rustfs-server
```
--------------------------------
### XFS File System Formatting and Mounting
Source: https://docs.rustfs.com/installation/checklists/hardware-checklists.html
Examples for formatting an XFS file system and recommended mount parameters for optimal performance and reliability.
```bash
# XFS formatting example
mkfs.xfs -f -L rustfs_disk1 -d su=256k,sw=10 /dev/sdb
# Recommended mount parameters
UUID=xxxx /mnt/disk1 xfs defaults,noatime,nodiratime,logbsize=256k 0 0
```
--------------------------------
### Download and Install RustFS Package
Source: https://docs.rustfs.com/installation/linux/single-node-single-disk.html
Download the latest RustFS Linux binary using wget, unzip it, make it executable, and move it to the system's PATH.
```bash
# Download address
wget https://dl.rustfs.com/artifacts/rustfs/release/rustfs-linux-x86_64-musl-latest.zip
unzip rustfs-linux-x86_64-musl-latest.zip
chmod +x rustfs
mv rustfs /usr/local/bin/
```
--------------------------------
### Environment Variable Configuration Example
Source: https://docs.rustfs.com/installation/docker/index.html
Demonstrates setting RustFS configuration parameters using environment variables within a Docker run command. This method is recommended for managing configurations.
```bash
-e RUSTFS_ADDRESS=:9000 \
-e RUSTFS_SERVER_DOMAINS=example.com \
-e RUSTFS_ACCESS_KEY=rustfsadmin \
-e RUSTFS_SECRET_KEY=rustfsadmin \
-e RUSTFS_CONSOLE_ENABLE=true \
```
--------------------------------
### Download and Install RustFS Package
Source: https://docs.rustfs.com/installation/linux/single-node-multiple-disk.html
Download the latest RustFS Linux binary using wget, unzip it, make it executable, and move it to a system-wide location like /usr/local/bin.
```bash
# Download address
wget https://dl.rustfs.com/artifacts/rustfs/rustfs/release/rustfs-linux-x86_64-musl-latest.zip
unzip rustfs-linux-x86_64-musl-latest.zip
chmod +x rustfs
mv rustfs /usr/local/bin/
```
--------------------------------
### Generate Presigned URLs - Download (GET)
Source: https://docs.rustfs.com/developer/sdk/javascript.html
Generate a presigned URL for downloading a file.
```javascript
import { GetObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
const url = await getSignedUrl(
s3,
new GetObjectCommand({ Bucket: "my-bucket", Key: "hello.txt" }),
{ expiresIn: 600 }
);
console.log("Presigned GET URL:", url);
```
--------------------------------
### Initializing the Client
Source: https://docs.rustfs.com/developer/sdk/go.html
Configure aws.Config using environment variables and initialize the S3 client for RustFS.
```APIDOC
## Initializing the Client
Configure `aws.Config` using environment variables and initialize the client:
```go
region := os.Getenv("RUSTFS_REGION")
access_key_id := os.Getenv("RUSTFS_ACCESS_KEY_ID")
secret_access_key := os.Getenv("RUSTFS_SECRET_ACCESS_KEY")
endpoint := os.Getenv("RUSTFS_ENDPOINT_URL")
if access_key_id == "" || secret_access_key == "" || region == "" || endpoint == "" {
log.Fatal("missing the env: RUSTFS_ACCESS_KEY_ID / RUSTFS_SECRET_ACCESS_KEY / RUSTFS_REGION / RUSTFS_ENDPOINT_URL")
}
// build aws.Config
cfg := aws.Config{
Region: region,
EndpointResolver: aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {
return aws.Endpoint{URL: endpoint},
}),
Credentials: aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(access_key_id, secret_access_key, "")),
}
// build S3 client
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
o.UsePathStyle = true
})
```
You can now perform bucket and object operations.
```
--------------------------------
### Initialize Go SDK Client for RustFS
Source: https://docs.rustfs.com/developer/sdk/go.html
Configure the AWS SDK for Go with RustFS credentials and endpoint. Ensure all required environment variables are set.
```go
region := os.Getenv("RUSTFS_REGION")
access_key_id := os.Getenv("RUSTFS_ACCESS_KEY_ID")
secret_access_key := os.Getenv("RUSTFS_SECRET_ACCESS_KEY")
endpoint := os.Getenv("RUSTFS_ENDPOINT_URL")
// usePathStyle := strings.ToLower(os.Getenv("AWS_S3_USE_PATH_STYLE")) == "true"
if access_key_id == "" || secret_access_key == "" || region == "" || endpoint == "" {
log.Fatal("missing the env: RUSTFS_ACCESS_KEY_ID / RUSTFS_SECRET_ACCESS_KEY / RUSTFS_REGION / RUSTFS_ENDPOINT_URL")
}
// build aws.Config
cfg := aws.Config{
Region: region,
EndpointResolver: aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {
return aws.Endpoint{
URL: endpoint,
}, nil
}),
Credentials: aws.NewCredentialsCache(credentials.NewStaticCredentialsProvider(access_key_id, secret_access_key, "")),
}
// build S3 client
client := s3.NewFromConfig(cfg, func(o *s3.Options) {
o.UsePathStyle = true
})
```
--------------------------------
### Docker Compose Service Definition for Permissions
Source: https://docs.rustfs.com/installation/docker
Example of adding a `rustfs_perms` service to `docker-compose.yml` to grant necessary permissions to RustFS volumes.
```yaml
services:
# grant the necessary permissions to RUSTFS volumes path
rustfs_perms:
image: alpine
user: root
volumes:
- /path/to/host_directory/volumes:/fix_path
command: chown -R 10001:10001 /fix_path
rustfs:
image: rustfs/rustfs:latest
depends_on:
rustfs_perms:
condition: service_completed_successfully
# ... other configurations
```
--------------------------------
### Command Line Parameter Configuration Example
Source: https://docs.rustfs.com/installation/docker/index.html
Illustrates configuring RustFS using command-line arguments directly in the Docker run command. Note that command-line parameters take precedence over environment variables.
```bash
--address :9000 \
--server-domains example.com \
--access-key rustfsadmin \
--secret-key rustfsadmin \
--console-enable \
```
--------------------------------
### Generate Presigned URLs - Download Link (GET)
Source: https://docs.rustfs.com/developer/sdk/python.html
Python code to generate a presigned URL for downloading an object from RustFS.
```python
url = s3.generate_presigned_url(
ClientMethod='get_object',
Params={'Bucket': bucket_name, 'Key': 'hello.txt'},
ExpiresIn=600 # 10 minutes validity
)
print('Presigned GET URL:', url)
```
--------------------------------
### Quick Upload/Download Script Template
Source: https://docs.rustfs.com/developer/sdk/python.html
Template functions for uploading and downloading files using Boto3 with RustFS.
```python
def upload_file(local_path, bucket, object_key):
s3.upload_file(local_path, bucket, object_key)
print(f"Uploaded {local_path} to s3://{bucket}/{object_key}")
def download_file(bucket, object_key, local_path):
s3.download_file(bucket, object_key, local_path)
print(f"Downloaded s3://{bucket}/{object_key} to {local_path}")
```
--------------------------------
### RustFS Management Tools
Source: https://docs.rustfs.com/troubleshooting/node.html
Examples of using RustFS management tools to check cluster status, trigger data healing, and monitor healing progress.
```bash
# View cluster node status
rc cluster status
```
```bash
# Trigger data healing for new node
rc heal --node rustfs-node-2.example.net
```
```bash
# Real-time tracking of healing progress
rc heal status --follow
```
--------------------------------
### Update Hosts Configuration
Source: https://docs.rustfs.com/troubleshooting/node.html
Example of how to add or modify an entry in the /etc/hosts file to point an old node's hostname to a new node's IP address.
```bash
# Example: Add or modify line in /etc/hosts
192.168.1.12 rustfs-node-2.example.net
```
--------------------------------
### Starting the Server
Source: https://docs.rustfs.com/developer/mcp.html
Commands to start the MCP server, with and without custom options.
```bash
# Start the MCP server
rustfs-mcp
# Or with custom options
rustfs-mcp --log-level debug --region us-west-2
```
--------------------------------
### Path Style Example
Source: https://docs.rustfs.com/integration/virtual.html
Example URL for Path Style S3 request mode.
```http
http://rustfs.com/test
```
--------------------------------
### Object Naming Conflict Example
Source: https://docs.rustfs.com/concepts/limit.html
Examples demonstrating operations that would cause namespace conflicts in RustFS.
```bash
PUT data/hello/2025/first/a.csv
PUT data/hello/2025/first/ # Conflicts with existing object prefix
PUT data/hello/2025/first/
PUT data/hello/2025/first/vendors.csv # Conflicts with existing object
```
--------------------------------
### Check RustFS Version
Source: https://docs.rustfs.com/upgrade-scale/availability-and-resiliency.html
Verify the installed RustFS version on an existing node. This is useful before upgrading or installing new components.
```bash
# Check rustfs version on existing node
/usr/local/bin/rustfs --version
```
--------------------------------
### Create RustFS Storage Directories
Source: https://docs.rustfs.com/installation/linux/single-node-single-disk.html
Create the necessary directories for RustFS data, logs, and TLS certificates. Ensure correct permissions are set for the RustFS user.
```bash
sudo mkdir -p /data/rustfs0 /var/logs/rustfs /opt/tls
sudo chmod -R 750 /data/rustfs* /var/logs/rustfs
```
--------------------------------
### Virtual Host Style Example
Source: https://docs.rustfs.com/integration/virtual.html
Example URL for Virtual Host Style S3 request mode.
```http
http://test.rustfs.com/
```
--------------------------------
### Vandermonde Encoding Matrix Example
Source: https://docs.rustfs.com/concepts/principle/erasure-coding.html
Provides an example of a Vandermonde matrix used in constructing the encoding matrix for Reed-Solomon codes with k=2 and m=2.
```math
G = \begin{bmatrix}
1 & 0 \\
0 & 1 \\
1 & 1 \\
1 & 2
\end{bmatrix}
```
--------------------------------
### Start RustFS with Observability Services
Source: https://docs.rustfs.com/installation/docker/index.html
Deploy RustFS along with observability tools like Grafana, Prometheus, Jaeger, and OpenTelemetry Collector using Docker Compose.
```bash
docker compose --profile observability up -d
```
--------------------------------
### Test S3 API with MinIO Client
Source: https://docs.rustfs.com/installation/docker
Commands to configure the MinIO client (`mc`) and test S3 API functionality by creating and listing buckets.
```bash
mc alias set rustfs http://localhost:9000 rustfsadmin ChangeMe123!
mc mb rustfs/mybucket
mc ls rustfs
```
--------------------------------
### Comment Out Observability Services
Source: https://docs.rustfs.com/installation/docker
Instructions to comment out lines in `docker-compose.yml` if only RustFS needs to be installed without other observability services.
```yaml
#depends_on:
# - otel-collector
```
--------------------------------
### Building from Source
Source: https://docs.rustfs.com/developer/mcp.html
Instructions for cloning the repository, building the MCP server, and locating the binary.
```bash
# Clone the repository
git clone https://github.com/rustfs/rustfs.git
cd rustfs
# Build the MCP server
cargo build --release -p rustfs-mcp
# Binary will be available at
./target/release/rustfs-mcp
```