minio客户端mc使用

1、安装客户端
wget -P  /usr/bin/ https://dl.min.io/client/mc/release/linux-amd64/mc
chmod u+x /usr/bin/mc
2、配置mc工具
mkdir -p ~/.mc/
cat <<EOF >~/.mc/config.json 
{
       "aliases":{
            "minio": {
                        "url": "http://local:9000",
                        "accessKey": "admin",
                        "secretKey": "admin",
                        "api": "S3v4",
                        "path": "auto"
                     }
                 }
}
EOF
3、测试
mc ls minio

4、创建、查看桶

cd ~./mc
mc mb minio/test
mc ls minio

5、创建桶生命周期

mc ilm import minio/test <<EOF
{
    "Rules": [
        {
            "Expiration": {
                "Days": 30
            },
            "ID": "test",
            "Filter": {
                "Prefix": "test/"
            },
            "Status": "Enabled"
        }
    ]
}
EOF

列出规则
mc ilm ls minio/test

6、创建用户密码及权限

cat <<EOF>platform-filesync-dev.json
{
  "Version": "2022-04-17",
  "Statement": [
    {
      "Action": [
        "s3:ListBucket",
"s3:GetBucketLocation",
"s3:GetObject", "s3:PutObject", "s3:DeleteObject" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::test/*" ], "Sid": "" } ] } EOF 添加用户 mc admin user add minio test test 添加角色 mc admin policy add minio test test.json 配置用户角色 mc admin policy set minio test user=test

 

 

 

posted @ 2022-04-25 11:06  苍茫宇宙  阅读(1080)  评论(0编辑  收藏  举报