Tag Archives: marathon

Docker container using Apache Mesos and Marathon

apache-mesos-logo apache-mesos-marathon-logo Docker Logo

Apache Mesos is an open source cluster manager developed at UC Berkeley. It provides resource isolation and sharing across distributed applications.

The figure shows the main components of Mesos. Mesos consists of a master daemon that manages slave daemons running on each cluster node. Mesos frameworks are applications that run on Mesos and run tasks on these slaves. Slaves are either physical or virtual machines, typically from the same provider.

mesos-architecture

Mesos uses a two-level scheduling mechanism where resource offers are made to frameworks. The Mesos master node decides how many resources to offer each framework, while each framework determines the resources it accepts and what application to execute on those resources.

Marathon is a container orchestration platform running on Mesos. Multiple container formats are supported and Docker is certainly the most common one!

This blog will show how to setup Mesos, Marathon, and run a simple Docker image. This setup is only for the brave of heart. I’m always interested in looking under the hood and that’s what motivated this post. But a future post will show a more seamless install.

Let’s get started!

Configure CentOS VM

Download CentOS and configure the VM as shown:

centos-7.1-install

Install Components

Install the different components required for this setup.

  1. Configure Mesos repo:
  2. Install Mesos and Marathon:
  3. Install ZooKeeper:
  4. Add Docker repo:
  5. Install Docker:

Configure Hostname/IP address Mapping

Edit /etc/hosts and create hostname and IP address mapping. Find IP address using ifconfig and choose the network interface enabled during CentOS installation.

Start Services

Start all the services

  1. Start Docker:
  2. Start ZooKeeper:
  3. Start Mesos master:
  4. Configure mesos and docker containerizers:
  5. Start Mesos slave:
  6. Start Marathon:
  7. Check for services:Mesos UI: http://127.0.0.1:5050
    Marathon UI: http://127.0.0.1:8080
    Logs: tail -f /var/log/messages
  8. Check Mesos master:
  9. Check Mesos slave:
  10. Check ZooKeeper:

Deploy Docker application to Mesos

A simple Docker-based application is defined using the configuration file. Marathon runs on port 8080 and so the updated configuration file looks like:

Deploy the application as:

The application will take some time in order to download the image and then run the container. This setup is slightly sensitive and multiple runs of the application showed that the Docker image was not successfully downloaded all the times. In that case, the Docker image was manually downloaded using docker pull python:3 and then the application could be successfully deployed.

In our case, master and slave are running on the same machine, and so the list of Docker images and running containers can be easily seen:

The application is available at port 31669 and can be seen at http://127.0.0.1:31669 as:

mesos-marathon-app-output

Mesos UI (http://127.0.0.1:5050) shows:
marathon-ui-app-output

Marathon UI (http://127.0.0.1:8080) shows:
mesos-ui-app-output

As you can see, this is quite an involving setup. A future blog post will show how to use DC/OS and set this up more seamlessly.

Further reading …

  • Mesos Marathon
  • Ports in Mesos
  • Mesos CLI
  • Mesos – Under the Hood

Mesos slack channel is awesome! Particularly I learned a lot about Mesos from @jgarcia.mesosphere, @akaplan.mesosphere, @harpreet.mesosphere, @graham.mesosphere. Thanks guys, keep up on engaging with the community!

Enjoy!

Source: http://blog.couchbase.com/2016/may/docker-apache-mesos-marathon

Paris Marathon 2015 – Electric and Runtastic

It took me ten years to run first international marathon. But so glad I choose Paris Marathon as the inaugural run. The experience was electric, really amazing, and runtastic.

Paris Marathon 2015

There are several common trends observed after running San Francisco, Sacramento, Napa Valley, and Big Sur marathons over the past years. So I’m taking this opportunity to share what I liked about the race, and what could possibly be improved. Some of this feedback may be tinted as I’ve only run marathons in the USA only so far.

Paris Marathon – The Good

  1. Cheerleaders: Number of spectators through out, literally through out, the course was definitely the best part of the race. And there were ~250,000 of them. Men, women, families, and so many little kids stretching their hands out and waiting for high-five, really kept the runners motivated.
  2. Attractions: How many races go through tourist spots like Eiffel Tower, Louvre, and Seine? OK, to be fair, San Francisco has Golden Gate Bridge and Golden Gate Park, Napa Valley has vineyards lined through out, and Big Sur runs along Highway 1 next to Pacific. In addition, how many races can claim to start and finish at a beautiful venue like Arc de Triomphe?
  3. Mile markers: Mile markers were done really right. They were tall, big bold numbers, and nicely stretched on a frame instead of fluttering flags. They could possibly withstand wind and rain, although the weather was very cooperative. Another important aspect was that there were mile markers, in addition to KM markers. This made it really helpful for the US runners as we are more used to former.
  4. Music: ~100 local bands were playing through out the race. There were very few moments that the music could not be heard.
  5. Corrals: With 50,000 runners (35% outside France and from 183 countries), the corrals were very well organized on Champs de Elysees. The corrals were starting with 3 hour pace, 15 minutes apart, and closed ~15 mins before their start.
  6. Paris Fire Department was sparing water using their hose at several points through out the course. Anybody running a marathon can appreciate the importance of that when the temperature is ~55-60F.
  7. Expo: This was the biggest expo with ~200 booths. It even had a 80m (CHECK) running track to try out new running shoes. There were plenty of clothes, running gear, accessories, etc. All the runner’s name were printed on a wall, and that was quite a crowded destination for everybody.

Paris Marathon – Areas of Improvement

  1. 436,497 number of plastic bottles with almost a million liters water were handed throughout the course. Based upon my personal observation, ~30% of the water was wasted. California is going through fourth year of drought, and there are several countries with severe water shortage. Hey, these places can take all the water! And plastic, really? Use paper glasses, runners and mother nature would love you for ever.
  2. Sports drinks (Powerade) were offered only once during the entire course. Plain water does not supplement the electrolytes lost during the race and so they should be offered at each water stand, in addition to water. That’s what I’ve experienced in all the US races so far.
  3. Water stations were at ~5k. This is fine for the first 15 miles, but they need to more frequent in the later miles.
  4. Pre-cut bananas were offered at each water stand. But banana peels and cobble stone do not make a good combination. Pre-peeled would be preferred.
  5. Finishers shirt was given after the finish line. It should instead be given at the Expo as that is more convenient.
  6. Only a limited number of food stalls were at the Expo. And also no place to hydrate.
  7. Communication on the pacing strategy with the pacer was futile as they didn’t know how to speak English.

This race made me create a new bucket list item, and that is to run a marathon in all seven continents. North America and Europe are now checked, lets see which one will be the next one.

I also like the idea of Conference Driven Marathon as suggested in the following tweet:

Lets see which conference is going to align their schedule with a marathon. Conference organizers, game on 😉

You are definitely missing out if you’ve never run this race. Its a big race, go run it!