AIStor Files
Operate

Take a Node Out of Service

What keeps serving when a node stops, how fast its cells move, and how to retire or add a pool.

Every node serves every export, so one node going down does not stop an export. AIStor splits each export into cells, and one node runs each cell. When a node stops, AIStor moves its cells to the other nodes, and moves them back when it returns. You do not need to move anything yourself.

File data lives in AIStor. A write is there once the client commits or closes the file, or at once for an O_DIRECT write, so a node going down does not lose it. A change to a name, such as a create or a rename, is in AIStor before the call returns.

What clients see while a node is down

  • Clients mounted through another node keep working. A call on a file in one of the stopped node's cells waits until another node serves that cell, then goes through. Opening a file can wait up to 90 seconds more while clients reclaim their locks. Files in other cells are not affected.
  • Clients mounted through the stopped node wait until it is back, on a hard mount. On a soft mount they get EIO. AIStor does not move a node's client address to another node. To go on sooner, mount the export through another node, or put the nodes behind a VIP or a load balancer.

Reboot or upgrade a node

Stop AIStor on the node as usual. AIStor stops the gateway first, and the gateway shuts down cleanly:

  • It writes buffered data to AIStor.
  • It saves the metadata of the cells it runs.
  • It releases the lease of each cell it runs.

Once the node has been out of reach for 15 seconds, AIStor gives its cells to the other nodes. A cell whose lease the gateway released is taken at once, without waiting out the lease term. A cell whose lease it could not release, for example because AIStor was unreachable, is taken once its lease has gone unrenewed for the lease term plus 3 seconds.

When the node is back, AIStor waits until it has reached the node without a break for 10 minutes. Then it moves the node's cells back to it, 4 at a time. Clients keep their locks during this move. If the node stops again within those 10 minutes, the wait starts over.

To upgrade every node, restart one node at a time. Before you restart the next node, wait until mc files export cells shows every cell serving.

If a node is lost

AIStor reassigns the cells of a node that has been out of reach for 15 seconds. A node that stopped without a clean shutdown still holds its cells' leases. The new node serves a cell only after the lost node's lease has gone unrenewed for the lease term plus 3 seconds. With the default term of 30 seconds, that is about 33 seconds after the lost node last renewed it. To change the term, see Change how fast cells move.

When the node comes back with its drives intact, AIStor moves its cells back to it once AIStor has reached it without a break for 10 minutes, as after a reboot. A change the lost node had not yet sent to AIStor is applied if the node returns within 24 hours, unless it conflicts with a change made after another node took the cell. Such a change is dropped, and the node logs it.

When a drive of the node is lost or replaced, you do not need to do anything. The aistor-files bucket holds each export's metadata, and the gateway keeps only a local copy of it on the node's drives. The gateway rebuilds the copy that was on the lost drive from the bucket, and the exports keep their files. A change that a client made in the last few seconds before the loss can be lost:

  • A buffered write is safe once the application calls fsync or closes the file.
  • A stable or O_DIRECT write is safe as soon as the write returns.
  • If the node that held a buffered write is lost before then, the fsync or close returns an I/O error (EIO).

The node's first drive is the exception. It also holds the gateway's own state: the sockets AIStor uses to reach the gateway, and the records that let NFS clients reclaim their opens and locks after a restart. A gateway that is running when that drive fails keeps running, but AIStor can no longer reach it, even after the drive is replaced. While the first drive is down, a client mounted through that node needs another gateway to reach its export, through a VIP, a load balancer, or by remounting elsewhere. Once the first drive is replaced, restart AIStor on the node. The gateway then rebuilds its state and the copies from the bucket in the same way. The clients of that node lose the locks they held and cannot reclaim them, so an application that held a lock must take it again. A client may also see ESTALE on a directory under the export root that it held from before the restart, and must look that directory up again.

Change how fast cells move

The lease term sets how long a lost node's cells wait before another node takes them. The default is 30 seconds. Set it with lease_ttl, from 10s to 10m, in whole milliseconds:

mc admin config set myaistor files lease_ttl=45s

A running gateway keeps its term until it next starts. To start every gateway with the new term at once, turn the gateway off and on. Every export stops while the gateways restart:

mc admin config set myaistor files enable=off
mc admin config set myaistor files enable=on

A shorter term moves cells sooner, but keep it longer than AIStor's drive max_timeout, 30 seconds by default. When a node goes silent, AIStor can pause writes for 20 to 30 seconds while it finds that node's drives offline. A term shorter than that pause fences healthy nodes: in testing, a 15-second term did. See Ownership and fencing.

Decommission a pool

Decommission the pool in AIStor as usual. AIStor first moves every cell off the pool's nodes, a few at a time, to the nodes that run the fewest cells. Clients keep their locks during these moves. The decommission finishes only once no cell runs on the pool. AIStor moves the file data in the bucket as it moves every other object.

Before you remove the pool, move the clients that mount through its nodes:

  • Move the address the clients mount, with a VIP or a load balancer, to another node. Every node reports the same NFS server scope, so the clients keep their mount and reclaim their opens and locks through the new node.
  • Or remount each client through another node, and update its mount configuration, such as /etc/fstab. A new mount is a new client: it holds no opens or locks from before. Stop the applications' I/O and have them close their files before the remount. After it, have them reopen their files and take their locks again before they resume.

To remove the package from the pool's nodes after the decommission, see Install.

Add a pool

Install the aistor-files package on the new nodes, then add the pool in AIStor as usual. AIStor then does two things:

  • It adds cells when the drive count reaches the next power of two. An export's cell count is the drive count rounded down to a power of two. For example, adding 32 drives to 64 adds no cells, and adding 64 doubles the count to 128. The new cells go to the nodes that run the fewest.
  • It moves existing cells onto the new nodes until every node runs within one cell of the others. A new node takes cells once it has been up for 10 minutes.

AIStor moves at most 4 cells at a time for balancing. To change that, set max_cell_moves. Set it to 0 to turn balancing off:

mc admin config set myaistor files max_cell_moves=8

Moves for a lost node or a decommission always run, and balancing waits until they finish. A file never changes cells, so a move does not change any file handle.