Skip to content

Latest commit

 

History

History
141 lines (98 loc) · 4.14 KB

minio.md

File metadata and controls

141 lines (98 loc) · 4.14 KB
copyright lastupdated keywords subcollection
years
2017, 2024
2024-04-18
cli, open source, minio
cloud-object-storage

{{site.data.keyword.attribute-definition-list}}

Using Minio Client

{: #minio}

The open source Minio Client{: external} could be your solution for using UNIX-like commands (ls, cp, cat, and so on) with {{site.data.keyword.cos_full}}. {: shortdesc}

Installation

{: #minio-install}

You can find installation instructions for each operating system is available in the Quick Start guide{: external} on the Minio website.

Configuration

{: #minio-config}

Adding your {{site.data.keyword.cos_short}} is accomplished by running the following command:

mc config host add <ALIAS> <COS-ENDPOINT> <ACCESS-KEY> <SECRET-KEY>
  • <ALIAS> - short name for referencing {{site.data.keyword.cos_short}} in commands
  • <COS-ENDPOINT - endpoint for your {{site.data.keyword.cos_short}} instance. For more information about endpoints, see Endpoints and storage locations.
  • <ACCESS-KEY> - access key that is assigned to your Service Credential
  • <SECRET-KEY> - secret key that is assigned to your Service Credential

The <ACCESS-KEY> and <SECRET-KEY> can be accessed/generated using HMAC {:tip}

The configuration information is stored in a JSON file that is at ~/.mc/config.json

mc config host add cos https://s3.us-south.cloud-object-storage.appdomain.cloud xx1111cfbe094710x4819759x57e9999 9f99fc08347d1a6xxxxx0b7e0a9ee7b0c9999c2c08ed0000

Sample Commands

{: #minio-commands}

A complete list of commands and optional flags and parameters are documented in the Minio Client Complete Guide{: external}

mb - Make a Bucket

{: #minio-mb}

mc mb cos/my_test_bucket

ls - List Buckets

{: #minio-ls}

Though all your available buckets are listed, not all objects might be accessible depending on the specified endpoint's region. {: tip}

mc ls cos
[2018-06-05 09:55:08 HST]     0B testbucket1/
[2018-05-24 04:17:34 HST]     0B testbucket_south/
[2018-10-15 16:14:28 HST]     0B my_test_bucket/

ls - List Objects

{: #minio-ls-objects}

mc ls cos/testbucket1
[2018-11-12 08:09:53 HST]    34B mynewfile1.txt
[2018-05-31 01:49:26 HST]    34B mynewfile12.txt
[2018-08-10 09:49:08 HST]  20MiB newbigfile.pdf
[2018-11-29 09:53:15 HST]    31B testsave.txt

find - Search for Objects by Name

{: #minio-find}

A full list of search options is available in the complete guide{: external} {: tip}

mc find cos/testbucket1 --name my*
[2018-11-12 08:09:53 HST]    34B mynewfile1.txt
[2018-05-31 01:49:26 HST]    34B mynewfile12.txt

head - Display few lines of object

{: #minio-head}

mc head cos/testbucket1/mynewfile1.txt

cp - Copy objects

{: #minio-cp}

This command copies an object between two locations. These locations can be different hosts (such as different endpoints or storage services) or local file system locations (such as ~/foo/filename.pdf).

mc cp cos/testbucket1/mynewfile1.txt cos/my_test_bucket/cp_from_minio.txt
...1/mynewfile1.txt:  34 B / 34 B  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  100.00% 27 B/s 1s

rm - Remove objects

{: #minio-rm}

More removal options are available on the complete guide{: external}

mc rm cos/my_test_bucket/cp_from_minio.txt

pipe - Copies STDIN to an object

{: #minio-pipe}

echo -n 'this is a test' | mc pipe cos/my_test_bucket/stdin_pipe_test.txt