简体   繁体   中英

Deploying Mysql on Mesos using Marathon

I have a mesos cluster with marathon and everything running in docker. I want to deploy production mysql and mongodb servers and am trying to figure out the best way to do service discovery.

Option 1 is to use the existing setup which proxies everything through an haproxy server sitting on one of the masters. My issue with this is that every query must make two hops, from app machine to master machine to db machine, even if the query originated on the machine the db is on. Is this actually significant or am I being pedantic?

Option 2 is to use mesos dns which I have set up but never used. This would require running the mysql docker image in host networking mode or adding 3306 to the ports a mesos slave can offer then immediately claiming 3306. I would then be able to use mysql.marathon.mesos as the host of any connection.

Option 3 would be to deploy the same haproxy server on every machine and use an app's local haproxy to send the queries to the right place. This seems a little bit better than option 1 because the first hop is always on the same machine but will require significantly more work to set up.

Has anyone done this before? What is the right pattern for these types of services?

Your option 2, using Mesos-DNS with static port reservation, is likely the safest (and most conservative) option.

Going forward, I suggest to also keep an eye on Mysos (MySQL on Mesos).

I would go with consul for service discovery, you also have marathon-consul which works pretty well.

Once a service is healthy it will be exposed as a service in the consul DNS.

Your difficulty would be if you want to make a galera/percona cluster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM