S3 Storage Migration
Get the Latest Code
Download the latest version of the project:
- The latest code includes a built-in
S3migration tool — no separate action required.
git clone https://github.com/openimsdk/open-im-server.git
cd open-im-server
Configuration File Guide
Modify the relevant configuration files under the config directory as needed to complete the S3 migration configuration:
- Edit the
openim-rpc-third.ymlconfiguration file- Locate and update the S3-related configuration items to match your migration requirements.
- About the
minio.ymlconfiguration file- If MinIO is not actually used in your project, this file can be ignored.
- If needed, update the S3 configuration items according to your migration requirements.
- The
object.enablefield inopenim-rpc-third.ymlspecifies the new S3 storage engine.
Build the S3 Migration Tool
- Navigate to the tools directory:
cd tools/s3
- Run the build command:
go build -o s3convert main.go
Start Migration
To ensure stability during data migration, follow these guidelines:
- Preparation
- Stop services: It is recommended to perform migration while services are stopped to avoid data inconsistency or operation conflicts.
- Backup MongoDB: Back up the data in the
s3collection to enable quick recovery in case of unexpected issues.
- Migration Notes
- The migration tool does not delete the original
S3data but will modify related records in thes3collection inMongoDB. - After migration is complete, verify data integrity to ensure all migration steps were executed correctly.
- The migration tool does not delete the original
- Run the migration command
<config dir path>: Specify the configuration file directory path.<old s3 name>: Enter the original S3 configuration name, e.g.,minio.
./s3convert -config <config dir path> -name <old s3 name>
- Example command
If configuration files are located in the
configdirectory and the original S3 name isminio:
./s3convert -config ./../../config -name minio
When you see the output success, the migration is complete.