A brief introduction to Mesos
Last updated: 10-Oct-2015
If you are already familiar with Mesos you can probably skip this part. In this section I will give a sort of management summary of Mesos and related components. In the next sections I will dive deeper into the details and help you set up your own Mesos cluster to play with.
So what is Mesos?
Mesos is a cluster manager. This means it can cluster the resources of multiple servers, basically offering this as one big machine where you can run your applications on. You can add and remove resources at any time, which makes this a scalable solution.
The way applications are build is changing. Traditionally one application or application component runs on one (virtual) machine, and everything is pretty static. With the uprising of (micro)services that spin up and down at request, this is no longer the most efficient solution. Resources need to be scalable, depending on the amount of requests. And where a service runs becomes transparant for the end user. Mesos offers the capabilities to do just that.
How does Mesos work?
Mesos works with a Master/Slave setup. The Mesos Master coordinates all the tasks and all the resources. The Slaves provide the resources where the tasks are executed. But Mesos cannot just run a task, it needs a Framework to do this. A Framework is a Mesos application that basically consists of two parts: A scheduler to receive and register tasks, and an executor that launches tasks on a Slave. Examples of Mesos Frameworks are Chronos and Marathon. Marathon is mostly used for long-running applications, where Chronos is more fit for scheduling jobs. Many other frameworks exist as you can see in the picture below.
What can we run on a Mesos cluster?
Pretty much anything that runs on Linux can be run on a Mesos cluster. Docker containers are an excellent example that fit very well with a Mesos cluster. But Mesos can do much more than only run Docker.
But what if the Mesos Master goes down? That would destroy everything.
Indeed! The Mesos Master is crucial for the cluster to work. This is why you have to add High Available components to your Mesos cluster. Usually this is done with Zookeeper, which is a tool that can replicate services in a distributed environment. For Mesos this works as follows: You install multiple Mesos masters, preferrably on different data centers. All Mesos masters have the same setup. From the available Mesos masters Zookeeper will elect a leader. The other masters are standby. If the leader would stop functioning, Zookeeper automatically elects a new leader, and all running tasks keep on running like nothing ever happened. The set of available Mesos masters is called a Quorum.
What about Mesosphere? What is the difference with Mesos?
Mesosphere is a complete cluster solution based on Mesos. Mesosphere includes components like Mesos, Marathon, Chronos and Zookeeper. Mesosphere makes it very easy to set up a high available Mesos cluster.
Are there any alternatives?
Sure! The most important one being Kubernetes, which has been developed by Google.
Further reading can be done here, which is an excellent article on Mesosphere.