The mc mirror command belongs to the MinIO Client (mc) tool and will not be installed with the MinIO server by default and needs to be installed separately.
- Install MinIO Client (mc)
Linux/macOS
Run the following command to install mc:
wget /client/mc/release/linux-amd64/mc -O /usr/local/bin/mc
chmod +x /usr/local/bin/mc
Then verify that the installation is successful:
mc --version
Windows
1. Download and install:
- MinIO official download address/client/mc
2. Rename and move to the C:\Windows\System32 directory (convenient to command line use).
3. Run in CMD or PowerShell:
mc --version
- Use mc mirror for data migration
Add old MinIO and new MinIO
mc alias set oldminio http://192.168.80.86:9000 minioadmin minioadmin
mc alias set newminio http://192.168.80.236:9000 minioadmin minioadmin
Perform data synchronization
mc mirror --preserve oldminio/ newminio/
⚡ Note: The --preserve option preserves the object's metadata (such as the modification time).
If incremental synchronization is required
mc mirror --overwrite oldminio/ newminio/
📌 Parameter description:
- --overwrite: Overwrite existing files on the new side
- --remove: Delete files that are not on the old side in the new side
- Verify data integrity
After synchronization is completed, you can use mc diff to verify:
mc diff oldminio/ newminio/
If the result is empty, it means that the data is consistent.
- Monitoring real-time synchronization (optional)
If you want to continue synchronization, you can add the --watch option:
mc mirror --watch oldminio/ newminio/
This way the new MinIO will synchronize the changes in the old MinIO in real time.
🚀 In this way, you can migrate MinIO data smoothly! Try it, if you have any questions, you can ask me anytime.