人本善良

导航

minio 集群部署


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.2020-12-23T02-24-12Z volumes: - data1-1:/data1 - data1-2:/data2 ports: - "9001:9000" environment: MINIO_ACCESS_KEY: minio MINIO_SECRET_KEY: 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 minio2: image: minio/minio:RELEASE.2020-12-23T02-24-12Z volumes: - data2-1:/data1 - data2-2:/data2 ports: - "9002:9000" environment: MINIO_ACCESS_KEY: minio MINIO_SECRET_KEY: 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 minio3: image: minio/minio:RELEASE.2020-12-23T02-24-12Z volumes: - data3-1:/data1 - data3-2:/data2 ports: - "9003:9000" environment: MINIO_ACCESS_KEY: minio MINIO_SECRET_KEY: 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 minio4: image: minio/minio:RELEASE.2020-12-23T02-24-12Z volumes: - data4-1:/data1 - data4-2:/data2 ports: - "9004:9000" environment: MINIO_ACCESS_KEY: minio MINIO_SECRET_KEY: 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 ## By default this config uses default local driver, ## For custom volumes replace with volume driver configuration. volumes: data1-1: data1-2: data2-1: data2-2: data3-1: data3-2: data4-1: data4-2:

minio 集群部署

第二部 设置nginx 负载均衡

mkdir -p /root/nginx/www /root/nginx/logs /root/nginx/conf   //创建容器挂载数组机目录

(如果nginx 已经运行则 docker cp c0b17cde708c:/etc/nginx/nginx.conf /root/nginx/conf  讲容器配置copy 到宿主机映射目录中)

docker run -d -p 8088:80 --name nginx-webss -v /root/nginx/www:/usr/share/nginx/html -v /root/nginx/conf/nginx.conf:/etc/nginx/nginx.conf -v /root/nginx/logs:/var/log/nginx nginx  //启动容器  

80为nginx 端口 8088为宿主机端口  讲容器配置目录映射到宿主机中的建立的目录中

 

如果nginx 访问不了 则可能是nginx.conf没有访问权限 需要chomd 777 nginx.conf

 


#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
include mime.types;
default_type application/octet-stream;

proxy_buffer_size 128k;
proxy_buffers 32 128k;
proxy_busy_buffers_size 128k;


sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

# 注意,这里的server名字即org.tonny.balance不能带下划线,tomcat是上面安装的tomcat
upstream org.tonny.balance {
server 192.168.109.131:9001 weight=1;
server 192.168.109.131:9002 weight=1;
server 192.168.109.131:9003 weight=1;
server 192.168.109.131:9004 weight=1;
}

server {
#注意,这里保留80,因为前面的docker运行命令,会映射80端口
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

# 不带数据的请求
location / {
root html;
index index.html index.htm;
#访问映射 设置最大文件大小为50M
client_max_body_size 50M;
proxy_pass http://org.tonny.balance;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

 

 

posted on 2020-12-25 15:27  简简单单2018  阅读(787)  评论(0编辑  收藏  举报