# About backup mechanism

**URL:** <https://forums.foundationdb.org/t/about-backup-mechanism/1477>\
**Category:** Using FoundationDB\
**Created:** [June 20, 2019, 5:52pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477 "2019-06-20T17:52:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhuyi29](https://avatars.discourse-cdn.com/v4/letter/z/edb3f5/32.png) [@zhuyi29](https://forums.foundationdb.org/u/zhuyi29)\
**Post date:** [June 20, 2019, 5:52pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/1 "2019-06-20T17:52:59Z")

</div>

We’re thinking using fdb for our application. One thing we want to know is that, since we have different clients (customers) using the database, is there a way to make/restore backup based to clients? Say, is it able for each client has a client id and their own backup?

Thank you!

---

<div class="post-metadata">

**Author:** ![SteavedHams](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/steavedhams/32/18_2.png) [@SteavedHams](https://forums.foundationdb.org/u/SteavedHams)\
**Post date:** [June 20, 2019, 9:06pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/2 "2019-06-20T21:06:44Z")

</div>

The short answer is “yes” but it’s up to your application to actually manage running backups and restores that are restricted to data pertaining to one of your customers.

FDB does not have a user concept. From the database’s perspective all of your user data is in one key space we call “user space” which is from “” to “\xff”. It’s up to your application to sub-divide that space into different ranges and use different ranges for your different users.

You can backup the entire database in one backup job, or you can target a specific key range and you can have many backups running, each targeting set of key ranges of your choosing. Regardless of which option you choose, restore tasks can also be restricted to a set of key ranges as well, so even if you have one backup for the entire database (the recommended option) you can still perform restores on a subset of data relevant to some subset of your users.

---

<div class="post-metadata">

**Author:** ![zhuyi29](https://avatars.discourse-cdn.com/v4/letter/z/edb3f5/32.png) [@zhuyi29](https://forums.foundationdb.org/u/zhuyi29)\
**Post date:** [June 21, 2019, 10:50pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/3 "2019-06-21T22:50:16Z")

</div>

Thank you for the clarification. So if we give each of our customer a unique prefix (using namespace/subspace like Subspace(prefix\_tuple, prefix\_element)), then we can backup/restore all key-value pair starting with this prefix right?  
And is it equal to your way of “Record Layer” concept described in [https://www.foundationdb.org/files/record-layer-paper.pdf](https://www.foundationdb.org/files/record-layer-paper.pdf)? I found the implementation at [https://github.com/FoundationDB/fdb-record-layer](https://github.com/FoundationDB/fdb-record-layer) outside of the official repo, has it been integrated to FDB yet? We are renting customers the database so we may need the data isolation and multi tenancy this Record Layer provides.

---

<div class="post-metadata">

**Author:** ![alexmiller](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/alexmiller/32/326_2.png) [@alexmiller](https://forums.foundationdb.org/u/alexmiller)\
**Post date:** [June 24, 2019, 8:20pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/4 "2019-06-24T20:20:35Z")

</div>

If you give a customer a unique prefix, you can use the [`-k` argument to `fdbbackup`](https://apple.github.io/foundationdb/backups.html#start) to back up only a restricted range of the key space, or do a backup of the whole database and use [`fdbrestore -k`](https://apple.github.io/foundationdb/backups.html#restore-start) to restore only a restricted subset of the keys.

The ability to backup and restore specific ranges individually is tangential to the record layer.

---

<div class="post-metadata">

**Author:** ![zhuyi29](https://avatars.discourse-cdn.com/v4/letter/z/edb3f5/32.png) [@zhuyi29](https://forums.foundationdb.org/u/zhuyi29)\
**Post date:** [June 24, 2019, 9:24pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/5 "2019-06-24T21:24:25Z")

</div>

Then what if we want to go with the record layer thing? Does record layer provides more data isolation and multi tenancy? That’s what we are looking for.

I’m also still a little bit confused here what’s the concept of record layer and how is this implemented and different from what you already have?

---

<div class="post-metadata">

**Author:** ![alexmiller](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/alexmiller/32/326_2.png) [@alexmiller](https://forums.foundationdb.org/u/alexmiller)\
**Post date:** [June 24, 2019, 10:57pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/6 "2019-06-24T22:57:33Z")

</div>

> [@zhuyi29](#):
>
> Does record layer provides more data isolation and multi tenancy?

The record layer makes it significantly harder for other users of the record layer API to trample on each other, and makes representing many small databases easier than running multiple FDB instances. There is no protection against one record layer user opening and using another record layer store in the same database. In the end, this is all just keys and values on FDB, and FDB has no native multi tenancy support.

So if all of your clients are using the record layer, then it’s much harder for them to issue a stray `clear_range(\x00, \xff)`. However, only mTLS would prevent a persistent person from doing so.

The record layer provides structured schemas for your data, schema changes, a query API, secondary indexes, etc., that are all really nice features to have when using FDB. It does not provide per-user QPS quotas, or storage size quotas, and you’d need to build those in to your application at a layer above FDB.

---

<div class="post-metadata">

**Author:** ![zhuyi29](https://avatars.discourse-cdn.com/v4/letter/z/edb3f5/32.png) [@zhuyi29](https://forums.foundationdb.org/u/zhuyi29)\
**Post date:** [June 27, 2019, 10:36pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/7 "2019-06-27T22:36:20Z")

</div>

Yes thanks.

I’m now encountering some problem with restore. I created a snapshot and the URL is something like `file:///.../backup-2019-06-27-21-39-37.925847`  
When I tried to describe this backup, is shows,  
Restorable: False  
SnapshotBytes: 0  
I checked the backup directory it do have data in the snapshot folder

---

<div class="post-metadata">

**Author:** ![SteavedHams](https://sea1.discourse-cdn.com/foundationdb/user_avatar/forums.foundationdb.org/steavedhams/32/18_2.png) [@SteavedHams](https://forums.foundationdb.org/u/SteavedHams)\
**Post date:** [July 12, 2019, 9:55pm UTC](https://forums.foundationdb.org/t/about-backup-mechanism/1477/8 "2019-07-12T21:55:42Z")

</div>

> [@zhuyi29](#):
>
> file:///…/backup-2019-06-27-21-39-37.925847

What files are in `file:///.../backup-2019-06-27-21-39-37.925847`?
