其他分享
首页 > 其他分享> > MinIO客户端操作(mc)

MinIO客户端操作(mc)

作者:互联网

查看minio服务

$ mc admin info server myminio

递归修复

$ mc admin heal -r myminio

指定桶修复

$ mc admin heal -r myminio/dev

JSON格式列出指定路径(文件、大小)

$ mc ls -r --json myminio/dev

{
 "status": "success",
 "type": "file",
 "lastModified": "2019-05-30T09:43:07.763-04:00",
 "size": 44996289,
 "key": "myFile",
 "etag": "bae58dc18zzzzz54c14e233b520e0a"
}

统计指定桶大小

$ mc ls -r --json myminio/dev | awk '{ FS=","; print $4 }' | awk '{ FS=":"; n+=$2 } END{ print n }'

 

策略管理

1.查看指定桶的策略

$ mc policy get-json myminio/dev

 

2.创建新策略/home/minio/policy/custom-dev.json

$ mkdir -p /home/minio/policy
$ vim /home/minio/policy/custom-dev.json

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": {
    "AWS": [
        "*"
      ]
    },
    "Action": [
      "s3:GetBucketLocation",
      "s3:ListBucket"
    ],
    "Resource": [
      "arn:aws:s3:::dev"
    ]
  },
  {
      "Effect": "Allow",
      "Principal": {
      "AWS": [
        "*"
      ]
    },
    "Action": [
      "s3:GetObject"
    ],
    "Resource": [
      "arn:aws:s3:::dev/*"
    ]
  }]
}

附:亚马逊S3策略生成网址

3.将JSON信息添加到指定桶策略
$ mc policy set-json /home/minio/policy/custom-dev.json myminio/dev

 

4.重新查询桶策略

$ mc policy get-json myminio/dev

 

用户管理

添加新用户newuser
$ mc admin user add myminio/ newuser newuser123

禁用用户newuser
$ mc admin user disable myminio/ newuser

启用用户newuser
$ mc admin user enable myminio/ newuser

删除用户newuser
$ mc admin user remove myminio/ newuser


标签:MinIO,mc,myminio,dev,json,policy,newuser,客户端
来源: https://blog.51cto.com/u_15187745/2749314