單機(jī)docker-compose部署minio過程
單機(jī)多副本docker-compose部署minio
簡單介紹
如果服務(wù)器有限可以單機(jī)掛載多硬盤實(shí)現(xiàn)多副本容錯(生產(chǎn)不推薦)
- 部署好的文件狀態(tài)

有兩個重要文件 docker-compose.yaml和nginx.conf
docker-compose.yaml是docker部署容器的配置信息包括4個minio和1個nginx容器
- 部署好的狀態(tài)

操作步驟
安裝docker
yum install docker

安裝docker-compose
curl -L https://github.com/docker/compose/releases/download/1.21.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

放置配置docker-compose.yaml文件和nginx.conf
mkdir /home/minios/ #創(chuàng)建文件夾

運(yùn)行docker-compose.yaml
systemctl enable docker systemctl start docker systemctl status docker docker-compose -f docker-compose.yaml up -d docker images #查看docker服務(wù)鏡像 docker ps #正在運(yùn)行的docker容器 docker ps -a #全部的docker容器 docker logs --tail 100 容器ID #查看容器日志信息 telnet 127.0.0.1 9000檢查是否成功
創(chuàng)建文件桶

docker-compose.yaml
version: '3.3'
# starts 4 docker containers running minio server instances.
# using nginx reverse proxy, load balancing, you can access
# it through port 9000.
services:
minio1:
image: minio/minio:RELEASE.2021-04-22T15-44-28Z
volumes:
- ./data1-1:/data1
- ./data1-2:/data2
expose:
- "9000"
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- fjjminio
restart: always
minio2:
image: minio/minio:RELEASE.2021-04-22T15-44-28Z
volumes:
- ./data2-1:/data1
- ./data2-2:/data2
expose:
- "9000"
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- fjjminio
restart: always
minio3:
image: minio/minio:RELEASE.2021-04-22T15-44-28Z
volumes:
- ./data3-1:/data1
- ./data3-2:/data2
expose:
- "9000"
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- fjjminio
restart: always
minio4:
image: minio/minio:RELEASE.2021-04-22T15-44-28Z
volumes:
- ./data4-1:/data1
- ./data4-2:/data2
expose:
- "9000"
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
command: server http://minio{1...4}/data{1...2}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
networks:
- fjjminio
restart: always
nginx:
image: nginx:1.19.2-alpine
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- "9000:9000"
depends_on:
- minio1
- minio2
- minio3
- minio4
networks:
- fjjminio
restart: always
networks:
fjjminio:
nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
# include /etc/nginx/conf.d/*.conf;
upstream minio {
ip_hash;
server minio1:9000;
server minio2:9000;
server minio3:9000;
server minio4:9000;
}
server {
listen 9000;
listen [::]:9000;
server_name localhost;
# To allow special characters in headers
ignore_invalid_headers off;
# Allow any size file to be uploaded.
# Set to a value such as 1000m; to restrict file size to a specific value
client_max_body_size 50m;
# To disable buffering
proxy_buffering off;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio;
}
}
}
總結(jié)
以上為個人經(jīng)驗(yàn),希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
docker 容器添加指定網(wǎng)絡(luò)地址的方法實(shí)現(xiàn)
Docker容器運(yùn)行的時候默認(rèn)會自動分配一個默認(rèn)網(wǎng)橋所在網(wǎng)段的IP地址,本文主要介紹了docker容器添加指定網(wǎng)絡(luò)地址的方法實(shí)現(xiàn),具有一定的參考價值,感興趣的可以了解一下2024-01-01
Docker化Spring Boot應(yīng)用的實(shí)踐
本文主要介紹了Docker化Spring Boot應(yīng)用的實(shí)踐,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-06-06
解決'nacos默認(rèn)secret.key配置不當(dāng)權(quán)限繞過漏洞'的問題
這篇文章主要介紹了解決“nacos默認(rèn)secret.key配置不當(dāng)權(quán)限繞過漏洞“的問題,解決這個問題需要對這個key的默認(rèn)值進(jìn)行修改,建議不要使用明文,可以用base64,key的長度要32位以上,下面介紹一下在兩種環(huán)境下的修改方法,感興趣的朋友一起看看吧2024-01-01
docker安裝influxdb的詳細(xì)教程(性能測試)
這篇文章主要介紹了docker安裝influxdb的詳細(xì)教程,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-07
docker安裝Jenkins執(zhí)行構(gòu)建jar運(yùn)行方式
這篇文章主要介紹了docker安裝Jenkins執(zhí)行構(gòu)建jar運(yùn)行方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-05-05
docker 安裝部署 Prometheus 與grafana的詳細(xì)過程
本文給大家詳細(xì)介紹了如何在CentOS 7上使用Docker和Docker Compose安裝和配置Prometheus和Grafana,并展示了如何進(jìn)行基本的監(jiān)控配置和數(shù)據(jù)可視化,感興趣的朋友跟隨小編一起看看吧2024-12-12

