192.168.1.9 mkdir -p /data/minio/data1 mkdir -p /data/minio/data2 /data/minio/data1 /data/minio/data2 192.168.1.10 mkdir -p /data/minio/data1 mkdir -p /data/minio/data2 /data/minio/data1 /data/minio/data2 192.168.1.11 mkdir -p /data/minio/data1 mkdir -p /data/minio/data2 /data/minio/data1 /data/minio/data2 192.168.1.12 mkdir -p /data/minio/data1 mkdir -p /data/minio/data2 /data/minio/data1 /data/minio/data2
minio.cnf
# Volume to be used for MinIO server. MINIO_VOLUMES="http://192.168.1.9/data/minio/data1 http://192.168.1.9/data/minio/data2 http://192.168.1.10/data/minio/data1 http://192.168.1.10/data/minio/data2 http://192.168.1.11/data/minio/data1 http://192.168.1.11/data/minio/data2 http://192.168.1.12/data/minio/data1 http://192.168.1.12/data/minio/data2" # Use if you want to run MinIO on a custom port. MINIO_OPTS="--address :9000 --console-address :36901 --config-dir /data/minio" # Root user for the server. MINIO_ROOT_USER=root # Root secret for the server. MINIO_ROOT_PASSWORD=Q1Cy9YRnsfBlyv94f
/usr/lib/systemd/system/minio.service
[Unit] Description=MinIO Documentation=https://docs.min.io Wants=network-online.target After=network-online.target AssertFileIsExecutable=/usr/local/bin/minio [Service] WorkingDirectory=/usr/local/ User=minio Group=minio ProtectProc=invisible EnvironmentFile=/etc/default/minio.cnf ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio.cnf\"; exit 1; fi" ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES # Let systemd restart this service always Restart=always # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE=65536 # Specifies the maximum number of threads this process can create TasksMax=infinity # Disable timeout logic and wait until process is stopped TimeoutStopSec=infinity SendSIGKILL=no [Install] WantedBy=multi-user.target # Built for ${project.name}-${project.version} (${project.name})
mkdir -p /data/minio mkdir -p /data/minio/{data1,data2} chmod -R +x /data/minio #创建minio用户 groupadd minio useradd -g minio minio mv /data/minio/minio.cnf /etc/default/ mv /data/minio/mc /usr/local/bin/ mv /data/minio/minio /usr/local/bin/ mv /data/minio/minio.service /usr/lib/systemd/system/ chown -R minio:minio /data/minio systemctl daemon-reload systemctl start minio systemctl enable minio
upstream minio-server { server 192.168.1.9:9000 weight=25 max_fails=2 fail_timeout=30s; server 192.168.1.10:9000 weight=25 max_fails=2 fail_timeout=30s; server 192.168.1.11:9000 weight=25 max_fails=2 fail_timeout=30s; server 192.168.1.12:9000 weight=25 max_fails=2 fail_timeout=30s; } server { listen 80; server_name localhost; charset utf-8; default_type text/html; location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $remote_addr; client_body_buffer_size 10M; client_max_body_size 10G; proxy_buffers 1024 4k; proxy_read_timeout 300; proxy_next_upstream error timeout http_404; proxy_pass http://minio-server; } }