Skip to main content

Label

A label is a letter that you attach to a Chunkserver so that placement rules can tell your servers apart.

What it is​

A label is a single letter, A to Z. You assign labels to a Chunkserver with the LABELS option in mfschunkserver.cfg. The letters are case insensitive. One Chunkserver has up to 26 of them at a time. A Chunkserver that sets no labels has none.

The letter itself has no meaning to MooseFS. You decide what the letter means. It can represent the site or the rack where a server is, or the kind of disks that the server holds. You might give H to the Chunkservers filled with hard drives, S to those with SSDs, and N to those with NVMe drives. MooseFS reads none of that from the letter. The meaning is in the placement rules that use the letter. Labels belong to the Chunkserver as a whole, not to one of its disks, so the same set applies to every chunk on that server.

The whole cluster uses one alphabet. The letter R means the same thing wherever you use it. On a cluster divided into locations PRO (PRO Edition only), a placement rule is written for one location and is matched only against the Chunkservers of that location. The same letter therefore selects a different set of servers in each location. A rule cannot match Chunkservers in another location.

Why it matters​

In an unlabeled cluster, the servers are interchangeable. The Master Server may put a chunk on any of them. Labels let you make that decision yourself. Label expressions are built from labels. A label expression is the placement rule for one storage state of a Storage Class. The expression decides which Chunkservers may hold the copies or erasure-coded parts of a chunk. To keep one copy per site, or to keep new data on servers with fast disks, you first label the servers.

The client can use labels as well. A mount can name preferred labels. The client then favors the Chunkservers that have those labels when it chooses where to do I/O.

How MooseFS implements it​

The Chunkserver reads LABELS at startup and turns the letters into a bit mask, one bit per letter of the alphabet. Letters are separated by , or ;. Spaces and tabs between them are ignored. Each of the following goes to the log: a repeated letter, a letter with no separator before it, a stray separator, and any character that is not a letter. Each log entry has a note that names the accepted form. Only the offending character is dropped, so a misformatted line still labels the server. The Chunkserver sends the mask to the Master Server at registration. When a configuration reload changes the mask, the Chunkserver sends the mask again. Relabeling a server therefore needs no restart.

The Master Server keeps the mask alongside everything else that it records about that server. The Master Server tests the mask against the label expression of the storage state in question. The Master Server runs this test when it picks Chunkservers for a new chunk, and when it reviews the copies and parts of a chunk that already exists. A copy on a Chunkserver that no longer matches the expression is replicated to a Chunkserver that matches. The Master Server does this only once nothing more urgent is pending, so a chunk that is short of copies is handled first.

The mask also goes to the GUI and mfscli, which turn it back into letters in the list of Chunkservers. The GUI can filter that list by one label. The CLI has no such filter. The CLI prints the letters in a labels column for you to filter yourself.

  • Storage Class: the policy whose label expressions decide where chunks go.
  • Chunkserver: the component that a label is attached to.
  • Chunk: the unit that is placed on the Chunkservers that a label expression selects.
  • Topology: the separate mechanism that tells the Master Server how far apart Chunkservers are.