2017-03-29 19 views
1

我对马拉松JSON低于如何在容器在HOST网络中运行时配置marathon-lb?

{ 
    "id": "/storage/mysql", 
    "cmd": null, 
    "cpus": 1, 
    "mem": 512, 
    "disk": 0, 
    "instances": 1, 
    "constraints": [ 
    [ 
     "hostname", 
     "UNIQUE" 
    ] 
    ], 
    "container": { 
    "type": "DOCKER", 
    "volumes": [], 
    "docker": { 
     "image": "reg.xxxxx.cn/library/mysql:5.7", 
     "network": "HOST", 
     "portMappings": [], 
     "privileged": true, 
     "parameters": [], 
     "forcePullImage": false 
    } 
    }, 
    "env": { 
    "MYSQL_ROOT_PASSWORD": "123456" 
    }, 
    "labels": { 
    "HAPROXY_GROUP": "internal" 
    }, 
    "portDefinitions": [ 
    { 
     "port": 3306, 
     "protocol": "tcp", 
     "labels": {} 
    } 
    ] 
} 

我觉得HAProxy的配置(在192.168.30.142 View the screenshot运行)是:

frontend storage_mysql_3306 
    bind *:3306 
    mode tcp 
    use_backend storage_mysql_3306 

backend storage_mysql_3306 
    balance roundrobin 
    mode tcp 
    server 192_168_30_144_31695 192.168.30.144:31695 

mysql的容器在192.168.30.144 View the screenshot运行,所以什么我想要的是:

server 192_168_30_144_3306 192.168.30.144:3306 

所以我该怎么做才能解决它呢? 谢谢!

+0

在[link](http://mesosphere.github.io/marathon/docs/ports.html)中我找到__hostPort:主机端口指定主机上要绑定的端口。与BRIDGE或USER模式联网一起使用时,可以指定从主机端口到容器端口的端口映射。在HOST网络中,默认请求的端口是主机端口。请注意,只有主机端口可通过环境变量提供给任务.__ –

回答

相关问题