Summary: Mesos provides a sophisticated, thoughtful API for many different user scenarios. Persistent volumes are features introduced by the new Acceptoffers API. Persistent volumes allow users to build a database framework for Mesos, and Mesos can persist data when any unforeseen failures and errors occur and affect the entire system. This article is selected from the use of Mesos framework to build distributed applications.
Until recently, Mesos had only been able to run services that did not need to store data to disk. This is because there is no way to reserve the required disk blocks. Starting with the Mesos 0.23 release, you can reserve disks.
We can use Mesos as a deployment system. Wouldn't it be nice if the MySQL database could automatically back itself up and create a new copy on demand? Or what if you have a simple, self-serving rest API that can create new Riak and Cassandra clusters? The work of building a database framework for Mesos began in 2014. The problem with these frameworks is that each host must create a special data partition and be managed outside of the mesos. With persistent volumes, projects like the Apache Cotton (MySQL) and the Cassandra and Riak Mesos frameworks can be started and maintained independently.
In Mesos's design, disk space is short-lived and is isolated by task. This is usually a good thing unless the user wants to persist the data. To solve this problem, Mesos introduces a new subtype of disk resources, called volume. Volume is a disk block that is assigned to a task and is mounted in a specific location. The API to complete this feature and the marathon API for mounting host volumes (see the "Mount host Volumes" section) are almost identical. Users can even create non-persistent volumes, which is useful when you want to expose multiple independent disks to Mesos.
Here's a look at how to create and use persisted volumes.
There are two acceptoffers operation used to create and destroy persistent volumes. Not surprisingly, they are called Create and destroy. You can only create persistent volumes on disk resources that have been reserved. Typically, users reserve resources, create volumes, and start tasks in a single acceptoffers, as shown in the following example.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170302112804552?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" Picture description "title=" Picture description "style=" border:0px;vertical-align:middle; "/>
The persistent volume resource is the same as a regular disk resource, but it has a field disk and is set to the appropriate diskinfo. DiskInfo names the persisted volume so that it can mount the name of the nested string sub-field persistence.id. The DiskInfo volume must use the RW mode (since Mesos 0.24 only supports RW). The volume Container_path field specifies where the container will be mounted in the task sandbox.
The persistent volume API is a new feature, so there is no production environment framework to use it. It also has some limitations, such as the volume must always be mounted as RW, and there is no way to expose multiple disks, or any disk or I/O isolation. Even after new features and features are added, the API is guaranteed to be back-compatible. As a result, projects like Apache Cotton have integrated persistent volumes in their code-kiri.
This article is selected from the "Use Mesos framework to build distributed Applications", click this link can be viewed in the blog post view of the book.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170302112555224?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvynjvywr2awv3mjawng==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/ Gravity/southeast "alt=" "Figure 1" "title=" "Figure 1" "style=" border:0px;vertical-align:middle; "/>
Want to get more good articles in time, you can search "blog point of View" or scan the QR code below and follow.
650) this.width=650; "src=" http://img.blog.csdn.net/20161128135240324 "alt=" Picture description "title=" Picture description "style=" border:0px; Vertical-align:middle; "/>
This article is from the blog of "Blog View blog", make sure to keep this source http://bvbroadview.blog.51cto.com/3227029/1902576
Mesos: Persisted volumes used by the database