0

我有一个分布式系统docker-compose。该系统包含多个MinIO服务 ( object-storage-<X>),它们在两个独立的服务器上运行。

现在的情况:

如果两个节点之一关闭,那么我的Nginx失败是因为Upsteam它不可用。

nginx: [emerg] host not found in upstream "object-storage-1:9000" in /etc/nginx/nginx.conf:7

预期行为:

如果两个节点之一关闭,则Nginx不应失败,因为一个节点可以正常工作。

Nginx我的配置的相关部分:

http {

    upstream minio {
        # The "object-storage-X" are services in my docker-compose file.
        server object-storage-1:9000;  # Node_1 with Storage_1
        server object-storage-2:9000;  # Node_1 with Storage_2
        server object-storage-3:9000;  # Node_2 with Storage_1
        server object-storage-4:9000;  # Node_2 with Storage_2
    }

    server {
        listen              9000 ssl;
        listen              [::]:9000 ssl;
        server_name         my.server.com;
        ssl_certificate     /ssl/domain.crt;
        ssl_certificate_key /ssl/domain.key;
        ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers         HIGH:!aNULL:!MD5;

        # 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 0;
        # 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;

        }
    }
...
...

我的 docker 服务的相关部分:

p_object-storage-1  replicated  0/1  minio/minio:RELEASE.2021-08-17T20-53-08Z  # Node_1
p_object-storage-2  replicated  0/1  minio/minio:RELEASE.2021-08-17T20-53-08Z  # Node_1
p_object-storage-3  replicated  1/1  minio/minio:RELEASE.2021-08-17T20-53-08Z  # Node_2
p_object-storage-4  replicated  1/1  minio/minio:RELEASE.2021-08-17T20-53-08Z  # Node_2

我的问题:

Nginx如果两个节点中的一个节点不可用,如何将我的配置配置为“保持活动状态”?

4

0 回答 0