minio client安装部署
环境:
OS:Centos 7
1.下载安装
mkdir /opt/minio_client/
cd /opt/minio_client/
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
2.设置访问的服务器
# myminio 是一个配置别名,后续使用mc命令的时候,就需要使用到这个别名
# root 是访问minio服务器的用户名和密码
[root@yunwei-k8s-dev soft]# /opt/minio_client/mc config host add myminio http://192.168.1.246:9000/ root admin123
mc: Configuration written to `/root/.mc/config.json`. Please update your access credentials.
mc: Successfully created `/root/.mc/share`.
mc: Initialized share uploads `/root/.mc/share/uploads.json` file.
mc: Initialized share downloads `/root/.mc/share/downloads.json` file.
Added `myminio` successfully.
3.mc命令文档
https://min.io/docs/minio/linux/reference/minio-mc.html?ref=docs
4.使用样例
递归列出桶a-bucket下面的所有文件
[root@yunwei-k8s-dev soft]# /opt/minio_client/mc ls --recursive --versions myminio/a-bucket
[2024-12-09 11:36:01 CST] 2.7KiB STANDARD null v1 PUT backup/mytest_bak_20241209/binlogs/insert_log/454414172884222009/454414172884222010/454414172884230327/454414172884230327/0/454414172883953044
[2024-12-09 11:36:01 CST] 458B STANDARD null v1 PUT backup/mytest_bak_20241209/binlogs/insert_log/454414172884222009/454414172884222010/454414172884230327/454414172884230327/1/454414172883953045
[2024-12-09 11:36:01 CST] 2.7KiB STANDARD null v1 PUT backup/mytest_bak_20241209/binlogs/insert_log/454414172884222009/454414172884222010/454414172884230327/454414172884230327/100/454414172883953042
[2024-12-09 11:36:02 CST] 504KiB STANDARD null v1 PUT backup/mytest_bak_20241209/binlogs/insert_log/454414172884222009/454414172884222010/454414172884230327/454414172884230327/101/454414172883953043
[2024-12-09 11:36:02 CST] 197B STANDARD null v1 PUT backup/mytest_bak_20241209/meta/backup_meta.json
[2024-12-09 11:36:02 CST] 248B STANDARD null v1 PUT backup/mytest_bak_20241209/meta/channel_cp_meta.json
[2024-12-09 11:36:02 CST] 2.0KiB STANDARD null v1 PUT backup/mytest_bak_20241209/meta/collection_meta.json
[2024-12-09 11:36:02 CST] 2.2KiB STANDARD null v1 PUT backup/mytest_bak_20241209/meta/full_meta.json
[2024-12-09 11:36:02 CST] 146B STANDARD null v1 PUT backup/mytest_bak_20241209/meta/partition_meta.json
[2024-12-09 11:36:02 CST] 875B STANDARD null v1 PUT backup/mytest_bak_20241209/meta/segment_meta.json
查看桶a-bucket下bakcup目录下的文件
[root@yunwei-k8s-dev soft]# /opt/minio_client/mc ls myminio/a-bucket/backup
[2024-12-10 09:09:51 CST] 0B mytest_bak_20241209/
5.下载minio服务器桶a-bucket目录到本地
/opt/minio_client/mc cp --recursive myminio/a-bucket/backup/mytest_bak_20241209 /soft/
下载后的文件如下:
[root@yunwei-k8s-dev soft]# ls
mytest_bak_20241209
可以对该目录进行打包下载后,通过minio web界面上传到其他的服务器进行恢复
6.上传到另外的minio服务器
添加minio目的服务器
[root@yunwei-k8s-dev soft]# /opt/minio_client/mc config host add myminio2 http://192.168.1.135:9000/ minioadmin minioadmin
Added `myminio2` successfully.
查看a-bucket桶下的文件
/opt/minio_client/mc ls --recursive --versions myminio2/a-bucket
上传文件夹
/opt/minio_client/mc cp -r /soft/mytest_bak_20241209 myminio2/a-bucket/backup
这里有个问题,发现以 mytest_bak_20241209 前缀的文件和目录也会上传,如下:
[root@yunwei-k8s-dev soft]# ls -1
mytest_bak_20241209 ##会上传
mytest_bak_20241209_001 ##会上传
mytest_bak_20241209_aa.tar ##会上传