# Copyright 2024 RustFS Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # MNMD (Multi-Node Multi-Drive) Docker Compose Example # 4 nodes x 4 drives configuration # This example demonstrates a complete, ready-to-use MNMD deployment # addressing startup coordination and VolumeNotFound issues. x-node-template: &node-template image: rustfs/rustfs:latest environment: # Use service names and correct disk indexing (1..4 to match mounted paths) - RUSTFS_VOLUMES=http://rustfs-node{1...4}:9000/data/rustfs{1...4} - RUSTFS_ADDRESS=0.0.0.0:9000 - RUSTFS_CONSOLE_ENABLE=true - RUSTFS_CONSOLE_ADDRESS=0.0.0.0:9001 - RUSTFS_EXTERNAL_ADDRESS=0.0.0.0:9000 # Same as internal since no port mapping - RUSTFS_ACCESS_KEY=rustfsadmin - RUSTFS_SECRET_KEY=rustfsadmin - RUSTFS_CMD=rustfs - RUSTFS_OBS_LOG_DIRECTORY=/logs command: [ "sh", "-c", "sleep 3 && rustfs" ] healthcheck: test: [ "CMD", "sh", "-c", "curl -f http://localhost:9000/health && curl -f http://localhost:9001/rustfs/console/health" ] interval: 10s timeout: 5s retries: 3 start_period: 30s networks: - rustfs-mnmd services: rustfs-node1: <<: *node-template container_name: rustfs-node1 hostname: rustfs-node1 ports: - "9000:9000" # API endpoint - "9001:9001" # Console volumes: - node1-data1:/data/rustfs1 - node1-data2:/data/rustfs2 - node1-data3:/data/rustfs3 - node1-data4:/data/rustfs4 rustfs-node2: <<: *node-template container_name: rustfs-node2 hostname: rustfs-node2 ports: - "9010:9000" # API endpoint - "9011:9001" # Console volumes: - node2-data1:/data/rustfs1 - node2-data2:/data/rustfs2 - node2-data3:/data/rustfs3 - node2-data4:/data/rustfs4 rustfs-node3: <<: *node-template container_name: rustfs-node3 hostname: rustfs-node3 ports: - "9020:9000" # API endpoint - "9021:9001" # Console volumes: - node3-data1:/data/rustfs1 - node3-data2:/data/rustfs2 - node3-data3:/data/rustfs3 - node3-data4:/data/rustfs4 rustfs-node4: <<: *node-template container_name: rustfs-node4 hostname: rustfs-node4 ports: - "9030:9000" # API endpoint - "9031:9001" # Console volumes: - node4-data1:/data/rustfs1 - node4-data2:/data/rustfs2 - node4-data3:/data/rustfs3 - node4-data4:/data/rustfs4 networks: rustfs-mnmd: driver: bridge volumes: node1-data1: node1-data2: node1-data3: node1-data4: node2-data1: node2-data2: node2-data3: node2-data4: node3-data1: node3-data2: node3-data3: node3-data4: node4-data1: node4-data2: node4-data3: node4-data4: