i would like to migrate my data to a S3 multi bucket system, but i don’t/can’t find any docs about this.
Migrate from a single to another single bucket is easy, as data is put into that bucket(even in another server/provider) and then Nextcloud configured to access that bucket, but what about to migrate from single to multi, as those multi buckets are created on the fly by Nextcloud?
A handful of people use S3 as their primary and fewer use multibucket.
I would start with comparing the database of primary vs multibucket and then figure out what changes you would have to make for the transfer. It’s going to involve editing the database no matter what.
I tried do that and it was working on my instance but I afraid to do that on my production environment.
First some basic info about my environment:
docker container - Database - PostgreSQL 12.5
docker container - Nextcloud 22.2.0
Storage backend - S3 - not Amazon, Ceph, single bucket
Now procedure I went through:
Enable Nextcloud maintenance mode
Replace bucket name in Nextcoud configuration (objectstore.arguments.bucket) from {{ current name }} to {{ current name }}-0
Restart Nextcloud
Rename bucket in Ceph s3 storage (my Ceph administrator do that because user can not, I need to rename bucket because simple sync does not respect copying of versions, and when I copy all objects and their version then timestamps of versions where not preserved. Simple sync will also work but all versions will be lost in that case).
Modify bucket name in database
docker exec postgresql psql --username=admin --dbname=nextcloud --command "update oc_storages set id='object::store:amazon::{{ bucket_name }}-0' where id='object::store:amazon::{{ bucket_name }}'"
Disable maintenance mode on Nextcloud
Ensure data is still present on Nextcloud
Again enable Nextcloud maintenance mode
Remove objectstore from Nextcloud configuration
Configure objectstore_multibucket on Nextcloud with:
bucket as {{ bucket_name }}-,
num_buckets as 4,
autocreate as true,
other arguments where the same as previous one.
Disable maintenance mode on Nextcloud
This procedure works but as I noticed new entries in Database table oc_storages:
so configuring objectstore_multibucket means that each bucket is saved in database as new bucket and it is not recognize as object::store:amazon::{{ bucket_name }} but as some kind of hash. This raises my concerns if such state will work in future. I imagine that on some future update some update script will clear old entry in database and then all files which where assigned to old storage in database will probably disappear.