Skip to main content

MinIO 单节点部署

  • MinIO 节点需要提前安装 Docker
  • Docker 安装后需执行 docker swarm init 命令初始化 swarm 环境
  1. 下载镜像

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2024-02-17T01-15-57Z
  2. 创建配置文件与数据存储目录

    mkdir -p /usr/local/minio
    mkdir -p /data/minio/volume
  3. 创建 minio 配置文件

    cat > /usr/local/minio/minio.yaml <<EOF
    version: '3'
    services:
    minio:
    image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-minio:RELEASE.2024-02-17T01-15-57Z
    environment:
    MINIO_ROOT_USER: "mingdao"
    MINIO_ROOT_PASSWORD: "123456789"
    volumes:
    - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
    - /data/minio/volume:/data/storage
    ports:
    - "9011:9000"
    # - "19111:9001" # minio console 的访问端口,有访问需求时可打开注释
    command: minio server /data/storage/data --console-address ":9001"
    EOF
    • MINIO_ROOT_USER 变量值即为对象存储的 accessKey
    • MINIO_ROOT_PASSWORD 变量值即为对象存储的 secretKey
  4. 配置启停脚本

    cat > /usr/local/minio/start.sh <<EOF
    docker stack deploy -c /usr/local/minio/minio.yaml minio
    EOF

    cat > /usr/local/minio/stop.sh <<EOF
    docker stack rm minio
    EOF

    chmod +x /usr/local/minio/start.sh
    chmod +x /usr/local/minio/stop.sh
  5. 启动 minio 服务

    bash /usr/local/minio/start.sh