Migrating data between two online MinIO instances

sibyx

Jakub Dubec

Posted on July 3, 2022

Migrating data between two online MinIO instances

Introduction

I use MinIO to store data for my personal Docker containers. It's super easy to use in applications and it solves problem data persistence in Docker (it's much more flexible than using volumes - sure, it also depends on the use-case).

Even though I am a quite satisfied developer I have to admit I struggled for a while trying to find out how to migrate data between two online MinIO instances. There is a GitHub issue for this situation but the response there is quite disappointing. I had to dig into documentation to find the response.

This article is for those who are lazy as I am and love quick straightforward solutions.

Preparation

We are going to use an official MinIO client called mc. I use macOS so installation is quite easy. The process supposes to be similar on different platforms.

In this example, we are going to migrate data from my_source to my_destination. We start with creating such a configuration. The default path is in your home directory of yours (~/.mc/config.json). The file is supposed to look like this (with your values).

{
    "version": "10",
    "aliases": {
        "my_source": {
            "url": "http://<remote_ip>:9001",
            "accessKey": "my_access_key",
            "secretKey": "my_secret",
            "api": "S3v2",
            "path": "auto"
        },
        "my_destination": {
            "url": "https://data.example.com",
            "accessKey": "my_access_key",
            "secretKey": "my_secret",
            "api": "S3v4",
            "path": "auto"
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

Migration

After configuration of your instances, the rest is quite simple. We are going to use a mc mirror command.

mc mirror my_source my_destination
Enter fullscreen mode Exit fullscreen mode

Simple as that!

💖 💪 🙅 🚩
sibyx
Jakub Dubec

Posted on July 3, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related