Hi Lakfes team, we are planning to move our lakefs...
# help
s
Hi Lakfes team, we are planning to move our lakefs infrastructure (including the S3 bucket and RDS) from one account to another. Is there a recommended way of migrating the Lakefs commit history, user accounts, blobs, etc. from one S3/RDS to another?
y
Hey @Sid Senthilnathan, thank you for your message. I'm considering options for you and will update here shortly
@Sid Senthilnathan, can you tell me if any of your repositories contain objects that were imported into lakeFS using one of the commands
lakectl inget
or
lakefs import
? I'm asking because such objects will require special treatment, as they do not exist in the buckets managed by lakeFS.
s
No, we have not used those commands
y
Ok, then it should be fairly simple to move. Let me draft up a sequence of actions you need to take.
So basically you have two options. One includes dumping and then importing your postgres instance into the new database. This will require making some manual changes to the database. The advantage of this method is that all your users and permissions will remain. The other method is to create a new installation of lakeFS and then use the
lakectl refs-dump
command to export the repositories. No manual db changes, but your users and permissions will need to be re-created. @Sid Senthilnathan, please tell me which option sounds better to you so I can give you further info.
s
We're planning on using an AWS managed RDS for the database, so I'm not sure how much configuration we'd be able to do. And we don't have too many users at this moment. So for those reasons I think the second method would work better.
y
I understand, so the first thing you should do is create a new installation of lakeFS on the new account
@Sid Senthilnathan, here are the steps you should take after your new installation is up and running: 1. For every repository on the old installation, run 
lakectl refs-dump
 (see reference): this writes all metadata related to the repository (commits, branches, tags) to the repository’s storage namespace. You should save the output of this command to a file, let's call it
my-repo-refs.json
. 2. For every such repository, create a bare repository on the new installation. Here you will decide the new storage namespace for each repository. 3. For every repository on the old installation, copy all the objects under the repository's storage namespace into a the corresponding new storage namespace in your new bucket. You can use rclone, distcp or another tool to copy the data. 4. For every new repository you have created, run
lakectl refs-restore
(see reference), with the file you created in step (1). Example:
Copy code
cat my-repo-refs.json | lakectl refs-restore <lakefs://my-new-bare-repository> --manifest -
Note:
refs-dump
doesn't handle uncommitted records. Everything should be committed before you do the migration.
s
Ok, this seems pretty straightforward. To confirm, once the migration process has started (executing the lakectl refs-dump) we would still be able to use the old repos right? The commits might become out of sync but from a read-only perspective it would still work right?
y
The old installation will not be affected by this command
s
Ok, thanks for your help!
y
You're most welcome! Please let us know if you need anything else