Data Migration, Backup and Recovery of Minio in Linux Environment

1. Please make sure that the Minio client has been installed on the server (installed can be ignored)

Download the client file for Linux
Linux version Minio client file download
and install the Minio client:

# 创建客户端安装目录
mkdir -p /home/minio/client
# 将二进制文件mc上传到client目录下,并对其添加可执行权限
cd /home/minio/client
chmod +x mc

At this point, the Minio client is installed.

2. Server Description

Assume that there are two Minio servers deployed in the Linux environment, namely the old server A and the new server B, and all operations are performed on the new server B.

3. Set an alias for the Minio server

Set up separate aliases for servers A and B on the new server B

# 切换到客户端程序目录(即mc文件所在目录)
cd /home/minio/client
# 在新服务器B设置服务器A的别名
./mc alias set minio_data_A http://11.11.11.110:9000 yourusername youruserpassword
# 在新服务器B设置服务器B的别名
./mc alias set minio_data_B http://22.22.22.220:9000 yourusername youruserpassword
# 查看已设置的Minio服务器的别名,看到上面设置的两个别名在列出的列表中即OK
./mc alias list

Explanation :
(a) minio_data_A and minio_data_B are the aliases set;
(b) http://11.11.11.110:9000 and http://22.22.22.220:9000 are server addresses;
(c) yourusername indicates the user account of Minio service on the server;
(d) youruserpassword indicates the user password of Minio service on the server.

4. Migrate data from server A to server B

# 切换到客户端程序目录(即mc文件所在目录)
cd /home/minio/client
# 将服务器A上名为“bucket-demo”的桶的数据迁移到服务器B的“bucket-demo”桶中
./mc cp --recursive minio_data_A/bucket-demo/ minio_data_B/bucket-demo/
# 将服务器A上所有数据迁移到服务器B中
./mc cp --recursive minio_data_A minio_data_B

Note :
When migrating all the data of a certain server at one time (without specifying the bucket name), all the buckets on the migration server A must exist on the new server B, otherwise it will prompt that the corresponding bucket cannot be found and the data cannot be migrated.

5. Back up the data of server B

# 切换到客户端程序目录(即mc文件所在目录)
cd /home/minio/client
# 将服务器B上名为bucket-demo的桶的数据备份到/home/minio/backup/bucket-demo目录
./mc cp --recursive minio_data_B/bucket-demo/ /home/minio/backup/bucket-demo
# 将服务器B上所有数据备份到/home/minio/backup/目录
./mc cp --recursive minio_data_B /home/minio/backup

6. Restore data on the Minio server based on the backup file

# 切换到客户端程序目录(即mc文件所在目录)
cd /home/minio/client
# 将/home/minio/backup/目录下的备份数据恢复到服务器B,注意备份文件目录路径需以'/'结尾
./mc cp --recursive /home/minio/backup/ minio_data_B
# 将某个桶(比如:bucket-demo)的备份数据恢复到服务器B的指定桶(比如:bucket-demo2)中
./mc cp --recursive /home/minio/backup/bucket-demo/ minio_data_B/bucket-demo2

Note:
(a) You can restore the backup data of a certain server to any server (not just the original server); (b
) You can restore the backup data of a certain bucket of a certain server to any bucket of any server (both buckets and servers can be different); (c) When migrating, backing up and restoring data, if a certain directory does not exist, just follow the prompt to create it
.

Guess you like

Origin blog.csdn.net/HLXTU/article/details/130866648