minio client安裝部署

slnngk發表於2024-12-10

環境:
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 ##會上傳

相關文章