MINIO对象存储搭建与使用

使用Docker快速搭建MINIO

docker-compose示例

version: '3'
services:
  minio:
    image: minio/minio
    container_name: "minio"
    volumes:
      - ./minio/data:/mnt/data  #存储数据
      - ./minio/config/minio:/etc/config.env    #minio为配置文件
      - ./minio/certs:/root/.minio/certs    #certs文件夹这里放置tls证书,证书名字为private.key,public.crt,如果不使用删除这行就可以了
    environment:
      MINIO_CONFIG_ENV_FILE: /etc/config.env    #配置环境参数,告诉docker配置文件使用哪个
    ports:
      - "9000:9000"   #服务端口
      - "9090:9090"   #管理端口
    command: server --console-address ":9090"
    restart: always
    networks:   #固定网络配置,看各自情况,如果不使用,删除下面的内容就好了
      minio_net:
        ipv4_address: 172.16.1.2
networks:
  minio_net:
    ipam:
      config:
      - subnet: 172.16.1.0/24

配置文件示例

# MINIO_ROOT_USER and MINIO_ROOT_PASSWORD sets the root account for the MinIO server.
# This user has unrestricted permissions to perform S3 and administrative API operations on any resource in the deployment.
# Omit to use the default values 'minioadmin:minioadmin'.
# MinIO recommends setting non-default values as a best practice, regardless of environment

MINIO_ROOT_USER=你的用户名
MINIO_ROOT_PASSWORD=你的密码

# MINIO_VOLUMES sets the storage volume or path to use for the MinIO server.

MINIO_VOLUMES="/mnt/data"

# MINIO_SERVER_URL sets the hostname of the local machine for use with the MinIO Server
# MinIO assumes your network control plane can correctly resolve this hostname to the local machine

# Uncomment the following line and replace the value with the correct hostname for the local machine and port for the MinIO server (9000 by default).

#MINIO_SERVER_URL="http://minio.example.net:9000"

linux挂载数据桶

先安装s3fs软件,设置好挂载点,在/etc下面兴建密钥文件passwd-s3fs,然后进入/etc/fstab进行挂载配置
s3fs#YourBucket /mnt/s3fs fuse _netdev,allow_other,use_path_request_style,url=YourMinioPiont:9000,passwd_file=/etc/passwd-s3fs 0 0
最后使用命令 mount -a 挂载文件即可