Object Storage Migration
Plan configuration, data migration, and access checks when changing storage.
Migrate S3 object storage
When switching your OpenIMServer object storage provider (for example, migrating from MinIO to an enterprise cloud S3 provider), use the built-in s3convert utility to update database object references without losing existing data.
Clone the repository
Clone the latest OpenIMServer repository:
git clone https://github.com/openimsdk/open-im-server.git
cd open-im-serverUpdate configuration files
Modify configuration files in the config/ directory to configure the new S3 target:
- Edit
openim-rpc-third.yml: - Update the configuration block for your new S3 provider with valid credentials and endpoint URLs.
- Set
object.enableto the name of the new target provider (e.g.,oss,cos,kodo, oraws). - Review
minio.yml: - If your deployment does not use MinIO, ignore this file.
- If migrating to or from MinIO, verify the connection parameters match the intended environment.
Compile the migration tool
- Navigate to the S3 tools directory:
cd tools/s3- Compile the migration binary:
go build -o s3convert main.goExecute the migration
To guarantee data consistency, follow these operational best practices:
- Pre-migration preparation:
- Stop services: Stop OpenIMServer instances to prevent concurrent writes and race conditions during migration.
- Back up MongoDB: Create a full backup of the
s3collection in MongoDB before executing the migration tool to allow rapid rollback if needed. - Migration behavior:
- The migration utility does not delete source objects in the legacy S3 bucket; it updates corresponding object locator records in MongoDB's
s3collection. - Validate data integrity and verify file accessibility after the migration command completes.
- Run the migration command:
./s3convert -config <config-dir-path> -name <old-s3-name><config-dir-path>: Path to the directory containing configuration YAML files.<old-s3-name>: Identifier of the source S3 provider being migrated away from (e.g.,minio).
- Example command:
If your configuration files reside in ../../config and you are migrating from minio:
./s3convert -config ./../../config -name minioWhen the output prints success, the database records have been successfully updated. Restart OpenIMServer to resume message and media processing.