marathon-lb的稳定性问题
假设在内部, 程序A去调用程序B使用api api-b,一共三个节点,通过域名api-b.marathon.mesos, 解析出来的A记录有三个,当然,解析出来的都是lb的地址,如果lb有一个挂了会有啥结果。短时间内是不是会造成502.
marathon-lb居然也有保留端口
marathon-lb居然还保留了端口。By default, port 10000 through to 10100 are reserved for marathon-lb services
marathon-lb的virtual host
知道marathon-lb有强大的端口转发能力,没想到,居然也有http和https的virtual host功能哦。 An important feature of marathon-lb is support for virtual hosts。
AWS为例,创建两个LB,检车是marathon-lb宿主机,端口9090,path /_haproxy_health_check.
externalnginx配置如下
{
"id": "nginx-external",
"container": {
"type": "DOCKER",
"docker": {
"image": "nginx:1.7.7",
"network": "BRIDGE",
"portMappings": [
{ "hostPort": 0, "containerPort": 80, "servicePort": 10000 }
],
"forcePullImage":true
}
},
"instances": 1,
"cpus": 0.1,
"mem": 65,
"healthChecks": [{
"protocol": "HTTP",
"path": "/",
"portIndex": 0,
"timeoutSeconds": 10,
"gracePeriodSeconds": 10,
"intervalSeconds": 2,
"maxConsecutiveFailures": 10
}],
"labels":{
"HAPROXY_GROUP":"external",
"HAPROXY_0_VHOST":"brenden-j-PublicSl-1LTLKZEH6B2G6-1145355943.us-west-2.elb.amazonaws.com(这个地址是AWS LB的地址)"
}
}
参考:
https://mesosphere.com/blog/2015/12/04/dcos-marathon-lb/
如何更快地做出反应
使用 Marathon Event Bus
marathon-lb里面的参数还可以修改
可以,使用template-url
{
"marathon-lb":{
"template-url":"https://downloads.mesosphere.com/marathon/marathon-lb/templates.tgz"
}
}
重新运行
dcos package install --options=options.json marathon-lb
marathon-lab支持 ssl
"labels":{
"HAPROXY_0_VHOST":"nginx.mesosphere.com",
"HAPROXY_0_SSL_CERT":"/etc/ssl/certs/nginx.mesosphere.com"
}
自动扩容
牛来个叉
marathon-lb-autoscale
扩展下
AWS ELB是几层负载
http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-listener-config.html
Elastic Load Balancing supports the following protocols:
HTTP
HTTPS (secure HTTP)
TCP
SSL (secure TCP)
Load balancers can listen on the following ports:
[EC2-VPC] 1-65535
[EC2-Classic] 25, 80, 443, 465, 587, 1024-65535