{"action":"created","issue":{"url":"https://api.github.com/repos/mesosphere/marathon-lb/issues/236","repository_url":"https://api.github.com/repos/mesosphere/marathon-lb","labels_url":"https://api.github.com/repos/mesosphere/marathon-lb/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/mesosphere/marathon-lb/issues/236/comments","events_url":"https://api.github.com/repos/mesosphere/marathon-lb/issues/236/events","html_url":"https://github.com/mesosphere/marathon-lb/issues/236","id":162281010,"number":236,"title":"connect mongodb failed: \"message len 1347703880 is invalid\"","user":{"login":"kiwenlau","id":10240841,"avatar_url":"https://avatars.githubusercontent.com/u/10240841?v=3","gravatar_id":"","url":"https://api.github.com/users/kiwenlau","html_url":"https://github.com/kiwenlau","followers_url":"https://api.github.com/users/kiwenlau/followers","following_url":"https://api.github.com/users/kiwenlau/following{/other_user}","gists_url":"https://api.github.com/users/kiwenlau/gists{/gist_id}","starred_url":"https://api.github.com/users/kiwenlau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiwenlau/subscriptions","organizations_url":"https://api.github.com/users/kiwenlau/orgs","repos_url":"https://api.github.com/users/kiwenlau/repos","events_url":"https://api.github.com/users/kiwenlau/events{/privacy}","received_events_url":"https://api.github.com/users/kiwenlau/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mesosphere/marathon-lb/labels/help%20wanted","name":"help wanted","color":"159818"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-06-25T13:25:39Z","updated_at":"2016-06-26T01:35:55Z","closed_at":null,"body":"I want to deploy mongodb using Mesos/Marathon platform, using marathon-lb for service discovery and load balance: \r\n\r\nI run mongodb using following JSON file:\r\n\r\n```\r\n{\r\n    \"id\": \"mongodb\",\r\n    \"labels\": {\r\n        \"HAPROXY_GROUP\": \"external\"\r\n    },\r\n    \"cpus\": 0.1,\r\n    \"mem\": 200.0,\r\n    \"instances\": 1,\r\n    \"healthChecks\": [{\r\n        \"path\": \"/\"\r\n    }],\r\n    \"container\": {\r\n        \"type\": \"DOCKER\",\r\n        \"docker\": {\r\n            \"image\": \"mongo\",\r\n            \"network\": \"BRIDGE\",\r\n            \"portMappings\": [{ \"containerPort\": 27017, \"hostPort\": 0, \"servicePort\": 27017, \"protocol\": \"tcp\" }]\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nBots Mesos UI and Marathon UI shows mongodb container is \"RUNNING\".\r\n\r\nmarathon-lb run on **192.168.59.1**\r\n\r\nmongodb container runs on **192.168.59.2**\r\n```\r\nsudo docker ps\r\nCONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS              PORTS                      NAMES\r\n93be32fb6a0d        mongo                   \"/entrypoint.sh mongo\"   About an hour ago   Up About an hour    0.0.0.0:31208->27017/tcp   mesos-cd96f097-4a00-4fb7-a47f-06fee07c5169-S1.9c45a0f3-ce46-476b-a010-b21544d14cac\r\n```\r\n\r\nHowever, I cannot connect mongodb through marathon-lb\r\n\r\n```\r\nmongo 192.168.59.1:27017\r\nMongoDB shell version: 3.0.1\r\nconnecting to: 192.168.59.1:27017/test\r\n2016-06-25T12:53:32.728+0000 I NETWORK  recv(): message len 1347703880 is invalid. Min 16 Max: 48000000\r\n2016-06-25T12:53:32.729+0000 I NETWORK  DBClientCursor::init call() failed\r\n2016-06-25T12:53:32.730+0000 E QUERY    Error: DBClientBase::findN: transport error: 192.168.59.1:27017 ns: admin.$cmd query: { whatsmyuri: 1 }\r\n    at connect (src/mongo/shell/mongo.js:181:14)\r\n    at (connect):1:6 at src/mongo/shell/mongo.js:181\r\nexception: connect failed\r\n``` \r\n\r\nAnd I can connect mongodb directly:\r\n```\r\nmongo 192.168.59.2:31787\r\nMongoDB shell version: 3.0.1\r\nconnecting to: 192.168.59.2:31787/test\r\n```\r\n\r\nfollowing is the **haproxy.cfg** generated by marathon-lb\r\n```\r\nglobal\r\n  daemon\r\n  log /dev/log local0\r\n  log /dev/log local1 notice\r\n  maxconn 50000\r\n  tune.ssl.default-dh-param 2048\r\n  ssl-default-bind-ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS\r\n  ssl-default-bind-options no-sslv3 no-tlsv10 no-tls-tickets\r\n  ssl-default-server-ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS\r\n  ssl-default-server-options no-sslv3 no-tlsv10 no-tls-tickets\r\n  stats socket /var/run/haproxy/socket\r\n  server-state-file global\r\n  server-state-base /var/state/haproxy/\r\n  lua-load /marathon-lb/getpids.lua\r\n  lua-load /marathon-lb/getconfig.lua\r\ndefaults\r\n  load-server-state-from-file global\r\n  log               global\r\n  retries                   3\r\n  backlog               10000\r\n  maxconn               10000\r\n  timeout connect          3s\r\n  timeout client          30s\r\n  timeout server          30s\r\n  timeout tunnel        3600s\r\n  timeout http-keep-alive  1s\r\n  timeout http-request    15s\r\n  timeout queue           30s\r\n  timeout tarpit          60s\r\n  option            redispatch\r\n  option            http-server-close\r\n  option            dontlognull\r\nlisten stats\r\n  bind 0.0.0.0:9090\r\n  balance\r\n  mode http\r\n  stats enable\r\n  monitor-uri /_haproxy_health_check\r\n  acl getpid path /_haproxy_getpids\r\n  http-request use-service lua.getpids if getpid\r\n  acl getconfig path /_haproxy_getconfig\r\n  http-request use-service lua.getconfig if getconfig\r\n\r\nfrontend marathon_http_in\r\n  bind *:80\r\n  mode http\r\n\r\nfrontend marathon_http_appid_in\r\n  bind *:9091\r\n  mode http\r\n  acl app__mongodb hdr(x-marathon-app-id) -i /mongodb\r\n  use_backend mongodb_27017 if app__mongodb\r\n\r\nfrontend marathon_https_in\r\n  bind *:443 ssl crt /etc/ssl/cert.pem\r\n  mode http\r\n\r\nfrontend mongodb_27017\r\n  bind *:27017\r\n  mode http\r\n  use_backend mongodb_27017\r\n\r\nbackend mongodb_27017\r\n  balance roundrobin\r\n  mode http\r\n  option forwardfor\r\n  http-request set-header X-Forwarded-Port %[dst_port]\r\n  http-request add-header X-Forwarded-Proto https if { ssl_fc }\r\n  option  httpchk GET /\r\n  timeout check 20s\r\n  server 192_168_59_2_31959 192.168.59.2:31959 check inter 60s fall 4\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mesosphere/marathon-lb/issues/comments/228579294","html_url":"https://github.com/mesosphere/marathon-lb/issues/236#issuecomment-228579294","issue_url":"https://api.github.com/repos/mesosphere/marathon-lb/issues/236","id":228579294,"user":{"login":"kiwenlau","id":10240841,"avatar_url":"https://avatars.githubusercontent.com/u/10240841?v=3","gravatar_id":"","url":"https://api.github.com/users/kiwenlau","html_url":"https://github.com/kiwenlau","followers_url":"https://api.github.com/users/kiwenlau/followers","following_url":"https://api.github.com/users/kiwenlau/following{/other_user}","gists_url":"https://api.github.com/users/kiwenlau/gists{/gist_id}","starred_url":"https://api.github.com/users/kiwenlau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kiwenlau/subscriptions","organizations_url":"https://api.github.com/users/kiwenlau/orgs","repos_url":"https://api.github.com/users/kiwenlau/repos","events_url":"https://api.github.com/users/kiwenlau/events{/privacy}","received_events_url":"https://api.github.com/users/kiwenlau/received_events","type":"User","site_admin":false},"created_at":"2016-06-26T01:35:55Z","updated_at":"2016-06-26T01:35:55Z","body":" The haproxy configuration may cause the problem. And maybe I need to change the mode to tcp instead of http according this:\r\n[\r\nHow to setup MongoDB behind Nginx Reverse Proxy](http://stackoverflow.com/questions/31853755/how-to-setup-mongodb-behind-nginx-reverse-proxy)\r\n\r\nBut how? the **haproxy.cfg** is generated by marathon-lb..."}}
{"actor":{"display_login":"kiwenlau"}}