0

我最近通過使用marathon-lb(在這個示例中它們平衡了一些nginx容器:https://dcos.io/docs/1.9/networking/marathon-lb/marathon-lb-advanced-tutorial/)完成了DCOS中負載平衡應用程序的教程。我試圖使用這種方法來內部負載平衡我自己的自定義應用程序。我正在使用的自定義應用程序是一個玩Scala應用程序。我設置了內部marathon-lb,並且可以成功將它用於nginx容器,但是當我嘗試使用自己的泊塢窗圖像時,我無法使其工作。我使用自定義映像啓動我的服務,並且可以使用分配給它的IP和端口訪問服務(即,如果服務部署在10.0.0.0上,並且在端口1234上可用,則curl http://10.0.0.0:1234/按預期方式工作並且我也可以在我的應用程序路線中定義我的API調用)。然而,當我試圖通過負載均衡器(curl -i http://marathon-lb-internal.marathon.mesos:10002,其中10002是服務端口)來訪問應用程序,然後我得到這個消息:無法通過Marathon-lb使用DCOS連接到服務

HTTP/1.0 503 Service Unavailable 
Cache-Control: no-cache 
Connection: close 
Content-Type: text/html 

<html><body><h1>503 Service Unavailable</h1> 
No server is available to handle this request. 
</body></html> 

供參考,這是我的JSON文件我用啓動我的定製服務:

{ 
    "id": "my-app", 
    "container": { 
    "type": "DOCKER", 
    "docker": { 
     "image": "my_repo/my_image:1.0.0", 
     "network": "BRIDGE", 
     "portMappings": [ 
     { "hostPort": 0, "containerPort": 9000, "servicePort": 10002, "protocol": "tcp" } 
     ], 
     "parameters": [ 
     { "key": "env", "value": "USER_NAME=user" }, 
     { "key": "env", "value": "USER_PASSWORD=password" } 
     ], 
     "forcePullImage": true 
    } 
    }, 
    "instances": 1, 
    "cpus": 1, 
    "mem": 1000, 
    "healthChecks": [{ 
     "protocol": "HTTP", 
     "path": "/v1/health", 
     "portIndex": 0, 
     "timeoutSeconds": 10, 
     "gracePeriodSeconds": 10, 
     "intervalSeconds": 2, 
     "maxConsecutiveFailures": 10 
    }], 
    "labels":{ 
    "HAPROXY_GROUP":"internal" 
    }, 
    "uris": [ "https://s3.amazonaws.com/my_bucket/my_docker_credentials" ] 
} 
+0

嗨,你解決了這個問題嗎?如果沒有,我會發送它!謝謝! –

回答

0

我有同樣的問題,並找到了解決辦法在這裏

marathon-lb health check failing on all spray.io containers

需要添加 「HAPROXY_0_BACKEND_HTTP_HEALTHCHECK_OPTIONS」:「http發送名頭的主機\ n超時檢查{healthCheckTimeoutSeconds}Š\ n」個

要你的配置,這樣的REST層不會對健康檢查從馬拉松樹皮

相關問題