美文网首页系统运维Minio
通过mc客户端连接minio服务器

通过mc客户端连接minio服务器

作者: 四冶读史 | 来源:发表于2017-08-07 08:39 被阅读25次

    1.概述

    minio提供的web界面不能删除bucket和创建文件夹,但其提供的mc客户端可以实现。minio还提供了其它客户端,如aws-cli,s3cmd,minio-go等,个人选择用mc,是因为mc是minio的客户端,也是推荐使用的。mc客户端可以安装在多种环境下,我以mac为例。

    2.安装mc客户端

    利用mac自带的brew

    brew install minio/stable/mc
    mc --help
    

    看到如下,则安装成功

    NAME:
     mc - Minio Client for cloud storage and filesystems.
    USAGE:
     mc [FLAGS] COMMAND [COMMAND FLAGS | -h] [ARGUMENTS...]
    COMMANDS:
     ls List files and folders.
     mb Make a bucket or a folder.
     cat Display file and object contents.
     pipe Redirect STDIN to an object or file or STDOUT.
     share Generate URL for sharing.
     cp Copy files and objects.
     mirror Mirror buckets and folders.
     diff Show differences between two folders or buckets.
     rm Remove files and objects.
     events Manage object notifications.
     watch Watch for files and objects events.
     policy Manage anonymous access to objects.
     admin Manage Minio servers
     session Manage saved sessions for cp and mirror commands.
     config Manage mc configuration file.
     update Check for a new software update.
     version Print version info.
    GLOBAL FLAGS:
     --config-folder value, -C value Path to configuration folder. (default: "/Users/shiye/.mc")
     --quiet, -q Suppress chatty console output.
     --no-color Disable color theme.
     --json Enable JSON formatted output.
     --debug Enable debug output.
     --insecure Disable SSL certificate verification.
     --help, -h Show help.
    VERSION:
     2017-06-15T03:38:43Z
    

    列出了一些命令和用法
    配置config.json
    执行命令,初始化配置文件

    mc ls play
    mc: Configuration written to `/Users/shiye/.mc/config.json`. Please update your access credentials.
    mc: Successfully created `/Users/shiye/.mc/share`.
    mc: Initialized share uploads `/Users/shiye/.mc/share/uploads.json` file.
    mc: Initialized share downloads `/Users/shiye/.mc/share/downloads.json` file.
    

    进入.mc/config.json,修改配置
    更改local和play的url、accesskey、secretkey为对的值,保存退出即可。
    可以将minio服务器全部添加进来,使用不同的别名,这样就可以使用diff来比较差异了。

    3.基础用法

    查看已创建的bucket

    mc ls play
    [2017-08-03 16:43:30 CST] 0B ops-dev/
    

    创建bucket

    mc mb play/musics
    Bucket created successfully `play/musics`.
    

    上传文件

    mc cp --recursive /Users/shiye/python/14/ play/musics/python
    ...t-server.py: 1.14 KB / 1.14 KB ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00% 12.49 KB/s 0s
    

    删除bucket

    mc rm --recursive --force play/musics
    Removing `play/musics/python/socket-client.py`.
    Removing `play/musics/python/socket-server.py`.
    Removing `play/musics/python/`.
    Removing `play/musics`.
    

    --recursive 递归
    --force 强制
    在执行rm时,建议慎重。

    参考地址:
    https://docs.minio.io/docs/minio-client-quickstart-guide

    相关文章

      网友评论

        本文标题:通过mc客户端连接minio服务器

        本文链接:https://www.haomeiwen.com/subject/fedolxtx.html