您的位置:首页 > 教育 > 锐评 > 达内前端_2023年8月上海疫情_搜索引擎排名优化程序_ip域名查询

达内前端_2023年8月上海疫情_搜索引擎排名优化程序_ip域名查询

2025/2/28 6:37:16 来源:https://blog.csdn.net/bennybi/article/details/144534573  浏览:    关键词:达内前端_2023年8月上海疫情_搜索引擎排名优化程序_ip域名查询
达内前端_2023年8月上海疫情_搜索引擎排名优化程序_ip域名查询

目录

1. 说明

2. 配置表

3. 步骤

3.1 放行服务端口

3.2 docker-compose 编排

4. 入口反向代理与负载均衡配置

4.1 api入口

4.2 管理入口

5. 用例

6. 参考


1. 说明

以多节点的Docker容器方式实现minio存储集群,并配以nginx反向代理及负载均衡作为访问入口。

2. 配置表

服务器 (2 nodes)

ip备注
center01.dev.sb172.16.20.20

Minio 入口(http://minio01.dev.sb)

管理入口 (http://minio01-console.dev.sb)

硬件配置:8核16G2T

软件配置:ubuntu22.04 + 宝塔面板 + nginx

node1172.16.20.10...

3. 步骤

3.1 放行服务端口

- 9000,9001

3.2 docker-compose 编排
services:minio0:restart: alwaysimage: 'bitnami/minio:latest'container_name: minio-node{x}hostname: minio{x}ports:- '9000:9000'- '9001:9001'environment:- MINIO_API_PORT_NUMBER=9000- MINIO_CONSOLE_PORT_NUMBER=9001- MINIO_ROOT_USER=admin- MINIO_ROOT_PASSWORD=you know- MINIO_DISTRIBUTED_MODE_ENABLED=yes- MINIO_DISTRIBUTED_NODES=minio{0...1}/bitnami/minio/data{0...1}- MINIO_SKIP_CLIENT=yesextra_hosts:- minio0:172.16.20.10- minio1:172.16.20.20volumes:- /data0/Server/Db/minio/data0:/bitnami/minio/data0- /data0/Server/Db/minio/data1:/bitnami/minio/data1

4. 入口反向代理与负载均衡配置

4.1 api入口
server {listen 80;listen  [::]:80;server_name minio01.dev.sb;# Allow special characters in headersignore_invalid_headers off;# Allow any size file to be uploaded.# Set to a value such as 1000m; to restrict file size to a specific valueclient_max_body_size 0;# Disable bufferingproxy_buffering off;proxy_request_buffering off;location / {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_set_header Host $http_host;proxy_cache_convert_head off;proxy_cache_key "$scheme$proxy_host$uri$is_args$args|$request_body";proxy_read_timeout 300s;proxy_connect_timeout 75s;proxy_http_version 1.1;proxy_set_header Connection "";chunked_transfer_encoding on;proxy_redirect off;proxy_pass http://minio_s3; # This uses the upstream directive definition to load balance}
}upstream minio_s3 {server 172.16.20.10:9000 weight=5;server 172.16.20.20:9000 weight=1;
}
4.2 管理入口
server {listen 80;listen  [::]:80;server_name minio01-console.dev.sb;# Allow special characters in headersignore_invalid_headers off;# Allow any size file to be uploaded.# Set to a value such as 1000m; to restrict file size to a specific valueclient_max_body_size 0;# Disable bufferingproxy_buffering off;proxy_request_buffering off;location / {rewrite ^/minio/ui/(.*) /$1 break;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_set_header X-NginX-Proxy true;# This is necessary to pass the correct IP to be hashedreal_ip_header X-Real-IP;proxy_connect_timeout 300;# To support websockets in MinIO versions released after January 2023proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";# Some environments may encounter CORS errors (Kubernetes + Nginx Ingress)# Uncomment the following line to set the Origin request to an empty string# proxy_set_header Origin '';chunked_transfer_encoding off;proxy_pass http://minio_console; # This uses the upstream directive definition to load balance}
}upstream minio_console {server 172.16.20.10:9001;server 172.16.20.20:9001;
}

5. 用例

from minio import Minio
from minio.error import S3Errordef main():# 创建 MinIO 客户端实例client = Minio(# "172.16.20.10:9000",  # MinIO 服务器地址和端口"minio01.dev.sb",  # MinIO 服务器地址和端口access_key="my key",  # 替换为你的 MinIO 访问密钥secret_key="you know it",  # 替换为你的 MinIO 秘密密钥secure=False,  # 使用 False 如果是 HTTP 而非 HTTPS)# 创建一个名为 "mybucket" 的存储桶bucket_name = "mybucket"if not client.bucket_exists(bucket_name):client.make_bucket(bucket_name)else:print(f"Bucket '{bucket_name}' already exists")# 上传文件file_path = "D:/Temp/demo/videos/acfa586c0b3248ec95df81267a767258.mp4"object_name = "acfa586c0b3248ec95df81267a767258.png"client.fput_object(bucket_name, object_name, file_path)print(f"'{file_path}' is successfully uploaded as object '{object_name}' to bucket '{bucket_name}'.")# 下载文件client.fget_object(bucket_name, object_name, "D:/Temp/tmp10/a2.mp4")print(f"'{object_name}' is successfully downloaded.")# 列出存储桶中的对象objects = client.list_objects(bucket_name)for obj in objects:print(obj.object_name)# 删除文件# client.remove_object(bucket_name, object_name)# print(f"'{object_name}' is successfully deleted.")if __name__ == "__main__":try:main()except S3Error as exc:print("error occurred.", exc)

 如图:

6. 参考

- Stat: Access Denied for Minio S3 Bucket behind Nginx Reverse Proxy with https enabled · Issue #4860 · restic/restic · GitHub

- Deploy MinIO: Multi-Node Multi-Drive — MinIO Object Storage for Linux

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com