Browse OpenIM Guides
Guides

Object Storage Migration

Plan configuration, data migration, and access checks when changing storage.

Copy

S3 storage migration

Get the Latest Code

Download the latest version of the project:

  • The latest code includes a built-in S3 migration 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:

  1. Edit the openim-rpc-third.yml configuration file
  2. Locate and update the S3-related configuration items to match your migration requirements.
  3. About the minio.yml configuration file
  4. If MinIO is not actually used in your project, this file can be ignored.
  5. If needed, update the S3 configuration items according to your migration requirements.
  6. The object.enable field in openim-rpc-third.yml specifies the new S3 storage engine.

Build the S3 Migration Tool

  1. Navigate to the tools directory:
cd tools/s3
  1. Run the build command:
go build -o s3convert main.go

Start Migration

To ensure stability during data migration, follow these guidelines:

  1. Preparation
  2. Stop services: It is recommended to perform migration while services are stopped to avoid data inconsistency or operation conflicts.
  3. Backup MongoDB: Back up the data in the s3 collection to enable quick recovery in case of unexpected issues.
  4. Migration Notes
  5. The migration tool does not delete the original S3 data but will modify related records in the s3 collection in MongoDB.
  6. After migration is complete, verify data integrity to ensure all migration steps were executed correctly.
  7. Run the migration command
  8. <config dir path>: Specify the configuration file directory path.
  9. <old s3 name>: Enter the original S3 configuration name, e.g., minio.
./s3convert -config <config dir path> -name <old s3 name>
  1. Example command

If configuration files are located in the config directory and the original S3 name is minio:

./s3convert -config ./../../config -name minio

When you see the output success, the migration is complete.