* Upgrade go version in CI.
* Add toolchain to pin version.
* Add linter/fumpt as pinned version in tools.
* Run `go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix -test ./...`
This will cause key paths to mismatch and not be sent.
Example:
```
λ go build&&mc stat -enc-c="play/testbucket/=MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDA" play/testbucket/mc
Name : mc
Date : 2025-07-02 17:52:42 CEST
Size : 43 MiB
ETag : 398345f23dc2ad4dd277e437e6ca7a1d-3
Type : file
Encryption: SSE-C
Metadata :
Content-Type: application/x-msdownload
```
The "replicate resync start" command requires the remote bucket ARN.
This is currently difficult to obtain and requires picking through the
output of "replicate list --json". Worse still, the JSON output doesn't
contain the human-readable host for the bucket, making it difficult to
know that you've got the correct one.
This change solves the issue by including the ARN in the default list
output.
* Remove block and mutex as they are rather intensive and provide little information.
* Add 'runtime'. Small, not intensive and possibly useful. Ignored by non-AIStor.
* Do 15 seconds for better data.
Now in checks we can get nil dereference while both struct has Content
field of nil. But in code we cheching for nil, and I believe that
testcase can be real:
```go
urls1 := URLs{};
urls2 := URLs{};
urls1.Equal(urls2);
```
* Giving mirror the option to exit early when --remove is not set
* Making sure always to cancel the context on exit
* Adding an internal flag to enable local listing only based on active/active and remove flags
* Renaming localListingOnly to sourceListingOnly
* Add `--enc` parameter to `mc support upload` to encrypt the file content.
* Add file size as zstd frame content size.
* Test opening the file before doing more.
* Uses same key as "mc support inspect".
For `--newer-than` and `--older-than`, allow using absolute times.
Example:
```
λ mc ls play/testbucket
[2025-01-22 09:57:12 CET] 676KiB STANDARD Daily checks Procedure for Portainer.docx
[2025-01-22 16:40:07 CET] 22KiB STANDARD dovrennost_mobilizaciya_0-2.docx
λ mc find -newer-than="2025-01-22 09:57:00 CET" play/testbucket
play/testbucket/Daily checks Procedure for Portainer.docx
play/testbucket/dovrennost_mobilizaciya_0-2.docx
λ mc find -newer-than="2025-01-22 09:57:13 CET" play/testbucket
play/testbucket/dovrennost_mobilizaciya_0-2.docx
```
We allow the same timestamp types as `--rewind` and add the printed type for easy copy+paste.
* Split to/from. t/f keys to go directly. <tab> to switch.
* Sort by queue size (q)
* Filter/Sort by reconnects (r)
* Add PgUp+PgDn
* Pause with <space>
Allows traces to be replayed in stats mode from `mc admin trace -json ALIAS >trace.json`, using `mc admin trace -in=trace.json`. `.zst` are automatically decompressed.
This is replayed at full speed, since I don't really see any value in keeping original speed.
Add scrolling to stats. Up+Down+Home+End
Add 'r' to reset min/max stats.
Healing in server side will list with quorum 1, so it will pick stale
objects as well. This is currently not rendered well in mc that shows
this cryptic message:
Invalid parity shard count/surplus shard count given
Print the text sent by the server instead.
* Default to list delete flags if they are part of the result set, so that they are not hidden from the find function
* Add --with-delete-marker flag to toggle the listing of delete markers. Defaults to false
* List delete markers as well when using the --versions flag
Avoid using the drive count concept to pick a color for a bucket healing
result. This was straightforward when we were healing a bucket per erasure
set, but now it becomes more complex to show a result.
Pick green if everything is okay, yellow if a bucket is missing in a
drive, red for any other drive state (unformatted, offline, ..), and
grey for any weird situation.
Client side overall status was always shown as `in-progress` even if
job was successful or failed.
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
This commit adds a string message and json output to mc pipe. The
implementation is heavily inspired by the one in mc cp, just adapted to
the different semantics of pipe.
Check the returned stream for errors and show them. Don't upload/keep pointless data
Use the request alias to create a better file name...
Example:
```
λ mc support inspect play/testbucket/testdat/**
mc: <ERROR> Unable to download file data. GetRawData: No files matched the given pattern.
```
Previously the error would just be ignored.
```
λ mc support inspect --airgap play/testbucket/testdata/**
File data successfully downloaded as inspect-play_testbucket_testdata.enc
```
Previously all files would be called `inspect-data.enc`, which would just be difficult to distinguish.
Currently, attempts to attach a policy to a user who already has
the policy attached to them results in a 400.
This change handles cases where policy attach/detach operations
are automated using scripts/jobs. A re-run of the attach/detach
step should not fail the entire job.
- Do not show healing ETA anymore; there are some scenarios where the
ETA can be wrong. Show when healing is started and the progress of the
healing drive usage compared to nonhealing drives in the same erasure set.
- `--verbose` prints only offline/faulty and healing drives
- `--all-drives` to show information about all drives
- Add yes/no prompt when a user wants to heal the whole namespace
Add checksums to pipe, cp, mirror commands.
> Add checksum to uploaded object. Values: MD5, CRC32, CRC32C, SHA1 or SHA256. Requires server trailing headers support like AWS, MinIO and possibly others.
`--md5` is hidden, but still applied.
Uploads to buckets with object locking will still use MD5.
Bonus: `mc stat` shows checksum information.
Currently, LDAP create-with-login command is not working properly when
the LDAP user does not have admin:CreateServiceAccount permission.
The permission is normally not needed since a user is allowed
to create a service account for itself. In that case, a temporary
account should be created and a new service account should be issued to
the temporary account access key, and not to the LDAP username as what
the code currently does.
This commit will send the correct target user in that case to make
create-with-login always successful.
Co-authored-by: Anis Eleuch <anis@min.io>
When the scanner uses parallel erasure sets scanning, the cycle concept
for the whole scan is no longer relevant. This PR will show the number
of ongoing bucket scans.
```
mc admin scanner status --bucket <bucket-name> ALIAS
```
Will print a detailed report of a particular bucket scan.
Like, when the last scan progress was saved for that bucket for all
erasure sets. Also it will print when a full scan of a bucket finished.
(A full bucket scan means the last time frame that was needed for each
of erasure sets to do sixteen cycles)
To ensure that the server can remove an internal tier configuration
when the tiering is unreachable or other corner cases where it is not
possible for the server to determine if the tier contains some data
or fully empty.
There is no suitable mechanism to estimate the ETA of healing when it is
retrying, although in most cases, it is just a listing that should be
quick enough. Hide the ETA anyway for now.
In a new MinIO version, Healing can be set to false while HealInfo is
not nil. This indicates that the drive was healed and the healing is
finished. This commit adapts the code with the new concept. This will
not break with older MinIO versions since those versions will already
remove .healing.bin, in that case Healing will be false, HealInfo will
be nil.
allow users to avoid list() call when an object does not
exist when following flags are used with `mc stat`
```
--no-list (HEAD the latest version)
--version-id <vid>
```
Also avoid superflous url2Stat() calls while processing
the args, there is no real reason to do that.
add global `--resolve HOST[:PORT]:IP` flag
This commit adds support for custom DNS overwrites via one or multiple
`--resolve` flags. It allows `mc` users to define custom DNS mappings
from a HOST (and optional port) to an IP address.
For example:
```
mc --resolve foo.com:9000=10.1.2.3 ls myminio/mybucket
```
The `--resolve` syntax is taken from cURL. Ref. `curl --help dns`
Use cases:
1. DNS overwrites. If there are no DNS resolvers available, e.g.
due to a temp. outage, this allows `mc` to connect to a defined
alias as long as the IP of the one or multiple cluster nodes are
known. It also allows `mc` to overwrite the current DNS responses.
This is useful for various tests in dev and staging environments.
2. TLS certificate verification. Often TLS certificates are issued
for some DNS names (via SAN) but not for IP addresses. IP addresses
are usually not static and might change anytime. Accessing a MinIO
cluster that serves a certificate containing only DNS SANs via an
IP address results in a TLS certificate verification error - even
if the certificate is issued by a trusted CA. The current workaround
is the `--insecure` flag which disables TLS certification completely.
Example for TLS verification:
```
$ mc alias set 'myminio' 'https://192.168.188.118:9000' 'minioadmin' 'minioadmin'
mc: <ERROR> Unable to initialize new alias from the provided credentials.
Get "https://192.168.188.118:9000": tls: failed to verify certificate:
x509: cannot validate certificate for 192.168.188.118 because it doesn't contain any IP SANs.
```
```
mc alias set --resolve foo.com:9000=192.168.188.118 'myminio' 'https://foo.com:9000' 'minioadmin' 'minioadmin'
Added `myminio` successfully.
```
Signed-off-by: Andreas Auernhammer <github@aead.dev>
When upload of the inspect file to SUBNET fails, following wrong message
was getting printed:
`Object inspection data for '' uploaded to SUBNET successfully`
Fixed the if condition to ensure that following correct message is
printed:
`File data successfully downloaded as <filename>`
Make `mc admin trace -stats` more compact, and hopefully more readable.
* Truncates durations more reasonably
* Use `-` for 0 TTFB.
* Use `↑151B ↓12K` instead of `↑ 151 B ↓ 12 KiB/m`
* Reduce FPS from 7 to 3 for less flickering.
Many listings would stop after the first version had been processed on Windows, since
For example, `mytls/testbucket/trace.json` != `mytls\testbucket\trace.json` would cause `mc undo` to only see one version since this would fail.
Use `getStandardizedURL` for both sides of these compares.
Add a flag --api-version with possible values of v2 and v3, with default
being v2.
So when this flag is not passed, the command will work exactly as it did
before.
When using v3, there is a different set of metric types supported. It
also supports a new flag:
bucket: the bucket for which the metrics are to be fetched. it is
applicable only for the metric types that are available at bucket level,
which currently are 'api' and 'replication'
Add a flag --api-version with possible values of v2 and v3, with the default
being v2. So when this flag is not passed, the command will work exactly
as before.
When using v3, a different set of metric types is supported. It
also supports two additional flags:
Bucket: the bucket for which the metrics are to be fetched. it is
applicable only for the metric types that are available at the bucket level,
which currently are 'api' and 'replication'
```
mc admin service restart local -w
Service status: ▰▱▱ [DONE]
Summary:
┌───────────────────────┬─────────────────────────────┐
│ Servers: │ 4 online, 0 offline, 0 hung │
│ Restart Time: │ 3.949842ms │
│ Background Init Time: │ 1.503707801s │
└───────────────────────┴─────────────────────────────┘
```
Existing UI didn't scale well for 100+ nodes, this
UI change is also made to provide clear guidance on
how soon the service is available v/s background
initialization time.
Combine into direct and indirect sections. See https://github.com/golang/go/issues/67948 for why this is a mess.
Enables running `go mod tidy` without blowing up things.
avoid weird coding style, simplify by using relatively
less number of variables and move things around to make
code more readable.
Improve HELP output readability.
Discretely adds the standard EC setting to regular `mc admin info`.
```
λ mc admin info play
● play.min.io
Uptime: 1 hour
Version: 2024-04-15T10:03:01Z
Network: 1/1 OK
Drives: 4/4 OK
Pool: 1
Pools:
1st, Erasure sets: 1, Drives per erasure set: 4
945 MiB Used, 409 Buckets, 5,498 Objects, 52 Versions, 4 Delete Markers
4 drives online, 0 drives offline, EC:2
```
Will save many deep dives into JSON.
In case Replication of ILM Expiry rules is disabled, mention the same
in `mc admin replicate status ALIAS` output.
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
Current mc admin bucket is visible under 'mc admin' however, mc admin
bucket will not show sub-commands, which is confusing.
Hide mc admin bucket and make mc admin bucket subcommands visible for
now, until removed later.
Also, add cross-compilation to CI. This includes all the archs we intend
to publish production binaries for.
`linux/mips64` was broken previously, and this is fixed by updating
github.com/shirou/gopsutil/v3 to the latest version.
fixes#4876
The latest `mc rb` test cleans all the site data, and on the demo site,
there are sometimes WORM files put in by some users, which leads to
a failure. This test should only be run on sites where the user knows he can
clean everything without errors.
Fixes#4874
`head -c 0` leads to an `head: illegal byte count -- 0` error under macOS. We should also provide the input with `-i` parameter (it's ok under GNU/Linux too)
There was a validation that said `--json` is supported only when
`--airgap` is also passed for SUBNET related `mc support` commands.
Remove this validation to allow `--json` to be passed even in online
mode. In this scenario, print a status JSON after upload to SUBNET.
In some very rare cases the license can contain a nil uuid
(00000000-0000-0000-0000-000000000000). Do not validate it against the
cluster's deployment id during registration.
Users would expect the mirror will not override anything unless --overwrite
flag is specified. However, currently --preserve will activate
--overwrite, which is not needed. This commit will fix this behavior.
This flag works in conjunction with `--recursive` and sets tags for all
the bucket objects minus the subdirs.
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
When the report is generated in airgap mode, mc shows a message
MinIO diagnostics report saved at<filename>
Here a space is missing between 'at' and the filename. Add the same.
Currently if we don't use absolute paths in mirror command, absolute path of
source gets appended to the target path and so in destination object gets
mirrored to wrong prefix / path.
For example say source object path is `/tmp/source/prefix/a.txt` and mirror
command executed from `/tmp` dir as `mc mirror --json --watch source xyz`,
the object in target gets mirrored to location `xyz/tmp/source/prefix/a.txt`.
Also any new file created gets copied properly though.
```
mc mirror --json --watch source/ xyz/
{
"status": "success",
"source": "/tmp/source/prefix/a.txt",
"target": "xyz/tmp/source/prefix/a.txt",
"size": 0,
"totalCount": 1,
"totalSize": 0
}
{
"status": "success",
"source": "/tmp/source/b.txt",
"target": "xyz/b.txt",
"size": 0,
"totalCount": 2,
"totalSize": 0
}
```
With the fix now after running the command `mc mirror --json --watch source xyz`
the object would correctly get copied to location `/tmp/xyz/prefix/a.txt` as below
```
{
"status": "success",
"source": "/tmp/source/prefix/a.txt",
"target": "xyz/prefix/a.txt",
"size": 0,
"totalCount": 2,
"totalSize": 0
}
{
"status": "success",
"source": "/tmp/source/b.txt",
"target": "xyz/b.txt",
"size": 0,
"totalCount": 1,
"totalSize": 0
}
{
"status": "success",
"source": "/tmp/source/c.txt",
"target": "xyz/c.txt",
"size": 0,
"totalCount": 3,
"totalSize": 0
}
```
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
If passed,
- validate and save it immediately in the subnet config
- extract API key from it and use it for online registration with SUBNET
(if `--airgap` is not passed)
- in case online registration with SUBNET fails for any reason, fallback
to airgap mode (show URL to be visited on SUBNET)
Also fixes errors potentially being swallowed by filtering.
Fixes#4773
```
λ go build&&mc cp s3/default/1.mp4 1.mp4
mc: <ERROR> Unable to prepare URL for copying. Unable to guess the type of copy operation.
λ echo %errorlevel%
1
λ _
```
Some users are confused about the 'Capacity' wording and think this is
about the objects usage, not disk usage; Change the wording to make this
is more clear.
Add new flags to `mc ilm tier add` command to support Azure storage
authentication using a service principal account:
--az-sp-tenant-id
--az-sp-client-id
--az-sp-client-secret
currently STS specific behavior is global,
`mc` however supports multiple aliases - we
need to make sure that `mc` treats this ENV
specific to an alias.
SUBNET is being enhanced to generate account-level licenses instead of
deployment-level. So newer licenses may not contain the deployment id.
So validate the deployment id against the cluster only if present in the
license.
The current spinner mechanism looks for the data categories (CPU,
drives, memory, etc) sequentially. If any of the category's data is not
received, it gets stuck there.
If a new data category is introduced without changing the version of the
HealthInfo struct, then `mc support diag` can get stuck for the new
category when talking to an older version of minio.
So instead of looking for the categories one by one, start a spinner for
each category at the beginning, and mark it as done as soon as the
corresponding data is received. When the last category (admin info) is
received, mark any pending category as done so that the command
continues with the rest of the processing.
This commit replaces the UBI minimal with the
small and less bloated UBI micro image.
This reduces noise from security scanners flagging
components not used by mc and reduces the overall
size of the container.
Signed-off-by: Andreas Auernhammer <github@aead.dev>
also change the UI to match a k8s'isk style
output.
```
mc admin trace play/ --stats
Duration: 12s ●∙∙
Call Count RPM Avg Time Min Time Max Time Errors RX Avg TX Avg
s3.GetBucketLocation 22 (48.9%) 107.8 431µs 205.196µs 1.360389ms 0 135 B 137 B
s3.ListObjectsV2 22 (48.9%) 107.8 1.615ms 520.96µs 6.821432ms 0 135 B 2.3 KiB
s3.ListBuckets 1 (2.2%) 4.9 2.302ms 2.301694ms 2.301694ms 0 135 B 29 KiB
```
If the terminal height is not enough to show the number of active disks,
which is likely the case in a large deployment, print only a few entries
until the number of lines reaches the terminal height.
An error in the result does not mean that the whole perf net test
failed, we can still show some results, with an error as well, to be
less confusing to the user.
this option exists to skip tiered objects such as
- "GLACIER"
- "DEEP_ARCHIVE"
users can use this option when migrating awss3 -> minio
```
mc mirror --exclude-storageclass GLACIER \
--exclude-storageclass DEEP_ARCHIVE s3/bucket minio/bucket
```
mc admin kms key status shows success for decryption when encryption is
failed, though the server does not test the decryption processs when the
encryption is failed. In such cases, this commit will show decryption with a
question mark instead of OK mark
It appears that this code is coming from the old days when locking was
implemented before versioning; It does not make sense now to make mv
errors out when a bucket has a locking configuration.
Earlier the command `mc admin prometheus generate ALIAS` used to
display only the scrape configuration for cluster metrics endpoint.
This change enables optionally to display scrape configuration for
node / bucket metrics endpoints.
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
Earlier the command `mc admin prometheus metrics ALIAS` used to
display only the cluster-level metrics. This change enables
optionally to list node/bucket-specific metrics.
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
Added endpoint and version attributes to KMS details
Now it would list details of all KMS instances with additional attributes
endpoint and version. In case of k8s based deployment the list would consist
a single entry.
Signed-off-by: Shubhendu Ram Tripathi <shubhendu@minio.io>
Rename `mc replicate diff` as `mc replicate backlog`
By default `mc replicate backlog` shows the most recent failures with additional
--nodes flag to filter output by node and --arn flag to filter by remote target.
This is a fast operation and provides a quick snapshot of backlog currently in failed
status.
`mc replicate backlog --full` does a full listing and reports all object versions in
pending or failed replication status.
- Fix table header being printed when the '--json' flag is present for
the 'mc admin svcacct list' command
- Fix sentinel date being marshaled when the '--json' flag is present
for the 'mc admin svcacct list' command
- terminal messaging for 'mc rm --dry-run' was completely
wrong, it was using `fmt.Println` which shouldn't be done.
- mc support perf - printing was using a mix of color.New()
and console.Infoln() (use one)
- mc support profile - printing was using a mix of color.New()
and console.Info() (use one)
- mc support inspect - printing was using a mix of color.New()
and consoleInfo() (use one)
The .golangci.yml file contains the root level key `linters-settings`
twice, resulting in following error when we run `make lint`:
```
> make lint
Running lint check
ERRO Can't read config: can't read viper config: While parsing config: yaml: unmarshal errors:
line 26: mapping key "linters-settings" already defined at line 1
make: *** [Makefile:36: lint] Error 3
```
Fixed by merging into a single key.
e.g:
`mc admin trace --request-header "User-Agent: *hadoop*" <alias>`
to print all S3 requests sent by Hadoop
`mc admin trace --request-header "!X-Minio-Source*" <alias>`
to avoid printing S3 requests related to replication
terminal control was not relinquished since ui.Start()
must not be run in a go-routine as it is expected
to be a blocking call, and must be serialized with when
an application exits.
refactor the 'scanner info/status' to ensure we have
correct behavior.
This PR also renames 'info-> status', keeps the older
one as alias for now.
The code that is being modified is from 2016. Currently, it does not set
an exit code status in the following cases, all of them are returned by
the FS layer:
BrokenSymlink
TooManyLevelsSymlink
PathNotFound
PathInsufficientPermission
There is no reason to avoid setting an exit code in this case. The only
functional change of this PR is by setting an exit code
many commands seem to have sort of had
stopped following the expected convention
in `mc` to differentiate *probe.Error.
To keep things readable this PR is the
first attempt at such a cleanup.
Earlier, the parsed config contained the `target` of the form
`subsystem:target` e.g. `logger_webhook:subnet`. Now it contains only
the target e.g. `subnet`.
Updating the `support logs status` command code accordingly to ensure
that it prints correct output.
- When the cluster is registered but either license or api-key
are available in the config, and when `--airgap` is not passed
to the command, try to automatically fetch and store the other
both.
- Add `--api-key` flag to `mc support diag`
- Use header-based auth with subnet
- Introduce a common function to initialize/check connectivity with subnet
- Make the health report upload function generic so that it can be used
by other commands like profile in future
- Add a global variable for airgapped mode
- Add more examples to `mc license register`
Passing the prefix in the aliased url is problematic for ilm edit
command when the user wants to modify something in the ILM rule: no
prefix in the url means the user wants to set an empty prefix or maybe
nothing. To fix this, add --prefix flag and make it a default choice in
the document.
Also, ilm edit will try to only apply passed flags. LifecycleOptions
fields are all pointers to apply only non nil fields to the ILM rule.
Change the JSON output of mc support perf
The new change will still print multiple JSON lines for each conducted
performance test but now we have a new field called 'type' field to
difference between network, drive and object tests.
This change also adds 'final' field to indicate this is the final json of a
particular performance testing.
Also, errors when conducting those tests will have a field 'err' as well
in the JSON output.
The new error message is:
```
$ mc rb --force play/testbucket/dir/
mc: <ERROR> Failed to remove `play/testbucket/dir/`. Bucket name `testbucket/dir/` not valid.
```
Names of the removed files when mc operatres on the filesystem are
not shown properly. The code is splitting the removed path into bucket
and prefix which doesn't make sense for filesystem.
The commit will just send the path of the removed object.
Co-authored-by: Anis Elleuch <anis@min.io>
When the account api key is passed to `mc license register` via the
`--api-key` flag and after the registration is successful, save it to
minio config, so that it can be used automatically in subsequent calls.
Also stop extracting and storing api key from the response of SUBNET
register api.
isURLPrefixExists() is used after url2Stat() function to check if the
given aliased URL corresponds to an existing prefix in the server. However,
url2Stat() is already doing that and returns valid information for
those prefixes.
Removing isURLPrefixExists() all together.
Instead of asking the user to
- open the subnet register page
- paste the registered token
- copy the generated license token
- paste it back on mc
Now we will simply ask the user to visit a subnet URL (which contains
the registration token as a query parameter). On visiting this page,
subnet will automatically register the cluster and generate a license
for it.
User can then optionally update the license on mc using
the `mc license update` command
This commit will make `mc support perf <alias>` to execute all
performance tests, networking, drive and object speed tests.
perf will only have --duration and --verbose flags.
The user can still test with 'drive', 'object', and 'net' but they will
be hidden for now along with their flags.
reset timer after the function body is finished
this is needed to make sure to wait "expected" amount
of time, otherwise the timer has already fired (negating
the wait of your function body)
Also adds option to check if the cluster has enough read quorum and if
the cluster is taken down for any maintenance.
Uses madmin.AnonymousClient for invoking the requests
strings.ReplaceAll(s, old, new) is a wrapper function for
strings.Replace(s, old, new, -1). But strings.ReplaceAll is more
readable and removes the hardcoded -1.
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Currently we only extract the `api_key` from SUBNET's registration api
response and store it in the minio subnet config. The response contains
license also, and it can be useful in getting information about the
subscription. So this PR enhances the register command to extract and
store the license also.
- Remove the get/set options under `callhome`
- Move logs settings to a separate command (`mc support logs`)
- Provide toggle options (`enable, disable, status`) for both the
commands
In case of logs (`mc support logs enable|disable|status`),
`enable` configures minio to push logs to SUBNET in real-time by
configuring the webhook `logger_webhook:subnet`
`disable` disables the webhook
`status` displays whether it is enabled or disabled
In the case of call home (`mc support callhome enable|disable|status`),
`enable` configures minio to automatically push callhome info to SUBNET
every 24hrs by setting the config `callhome enable=on`
`disable` disables callhome by setting `enable=off`
`status` displays whether it is enabled or disabled
The current implementation didn't cater to concurrency
factor i.e X calls happening in parallel so the
resulting values for IOPs, RX, and TX were all skewed,
change this to print totals instead.
We need to bring moving average behavior to know
the overall IOPs, RX, TX per second here.
Will bring this change subsequently, keep it simple
for now.
Change the success message on cluster registration to `{alias}
registered successfully`.
When the `mc support register` command is run for an already registered
cluster, show the message `{alias} updated successfully` to indicate
that updated information about the cluster was sent to SUBNET.
ETA disk during healing was not accurate especially when the number of
files is low. The reason is that the estimation is based on time.Now()
though heal info in the server side is only updated each minute.
Use heal info last update field instead of time.Now().
When there is no SUBNET webhook configured in the cluster (which is the
default state), the `mc support callhome get` command fails as it tries
to fetch the `logger_webhook:subnet` setting which doesn't exist.
Fixed by ignoring the specific error that says the sub-system target
doesn't exist, and printing `logs=off` in such cases.
Not trusted TLS error message has another string representation in
Darwin platform. Since there is no another way to test for this specific
error with Golang API, we will need to support this alternate error message.
Earlier the `support diag` command used to work even when the cluster
was not registered with SUBNET. In such cases, it used to pass the value
of `--name` flag as the cluster name to be set on SUBNET.
Now it errors out if the cluster is not registered. i.e. It expects the
cluster to be already registered with SUBNET, which means it already has
a name. Hence the `--name` flag is meaningless.
Removing the code that used this flag, and marking it as hidden and
deprecated.
This PR in-turn ends up supporting cascading deletes
for `mc mirror` setups when you have
```
mc mirror --watch alias1 alias2
mc mirror --watch alias2 alias3
```
IT still avoids cyclical deletes such as
```
mc mirror --watch alias1 alias2
mc mirror --watch alias2 alias1
```
client-s3.Stat() does not properly detect a prefix when there is another
lower one,
e.g: Stat() of 'dir/' fails when there is 'dir-name/' in the same parent
prefix.
In a site wide mirroring, non existing buckets in the destination site
are still created if --dry-run is passed. This commit will avoid this.
This commit also prints a mirror message of the newly created buckets
in a site wide mirroring.
When mirror in --watch mode is restarted, the previous minio-go
ListenNotification/ListenBucketNotification call is not properly
canceled. This commit creates a new context for that listen call and
cancels it when client-s3 Watch() is asked to be stopped.
Also remove the `--full` flag and run the new perf tests (that run quite
fast) always (if the minio version supports it).
In case of older versions of minio that have the older versions of the
performance tests, mc will not request for those tests to be run, and
subsequently will not look for their results in the response.
Removing an old code that calculates incorrectly the bucket and object
from the client-s3.targetURL. The old code assumed that
client-s3.targetURL can have this style
http://bucket.endpoint/prefix/object but this is not true.
client-s3.targetURL will always have this endpoint style
https://endpoint/bucket/object whenever vhost is enabled or not for a
given alias.
Co-authored-by: Anis Elleuch <anis@min.io>
Currently, when mirror is not able to copy an object (e.g. corrupted)
and watch is specified, mirror will restart mirroring again to stop
again at the same problematic object.
Co-authored-by: Anis Elleuch <anis@min.io>
Do no miss sending object/version to contentCh when there is deletion
result available.
This commit fixes issues seen when some objects/versions are not deleted
when --no-current is passed.
Co-authored-by: Anis Elleuch <anis@min.io>
Earlier commit #8eae2e3bbfafe952ecb33904c0d9073871a32169 reverted
this behavior, bringing it back
Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
This PR also changes the interpretation of --non-current flag to delete
all non current versions that qualify irrespective of whether top level
version is a delete marker.
Co-authored-by: Poorna Krishnamoorthy <poorna@minio.io>
automatic prompt for certs broke system trusted tls endpoints
since it ignored the currently loaded certs as trusted.
if they are available and we can establish TLS we should
proceed instead of failing and asking users to always use
`--insecure`
--insecure does not have an effect when running mc in a non-terminal. This
commit fixes the behavior by ignoring the prompt from trusting self
signed certificate when --insecure is passed as well.
This commit adds an extension to the `alias set`
command. When adding an alias fails due to a TLS
trust error - i.e. remote peer certificate verification
fails - `mc` fetches the remote peer certificate,
computes the public key fingerprint and asks the user
to confirm the fingerprint.
When the user confirms the fingerprint, the certificate
is added to the `CAs` directory.
This allows users to use a TOFU authentication with
self-signed certificates - similar to SSH.
Signed-off-by: Andreas Auernhammer <hi@aead.dev>
A recent commit changed the behavior of client-s3.GetObjectLockConfig()
without properly checking the behavior of the callers introducing a bug
during mv command where the target is an S3 server.
Add some tests for the mc mv command as well.
* Add `mc support callhome get` command
Will print all the callhome settings (currently just `logs=on|off`)
* Rename retrieveCallhomeSetting to printCallhomeSetting
As it doesn't need to return anything, and only prints the setting.
this is essentially the same code at
https://github.com/minio/minio/tree/master/docs/debugging/xl-meta
--export option provides exporting 'xl.meta' information as 'JSON'
or export the inlined-data 'JSON' that represents 'version-id' and
the corresponding size of the inlined data.
This essentially now provides full visibility of the inspected data
that is captured, extracts and converts into some parseable
JSON.
minio now supports storing the proxy to be used for connecting to subnet
in the `subnet proxy` config. So mc can use it if available when
communicating with subnet during cluster registration or diagnostics
upload.
This change bumps the lipgloss and termenv dependencies, which prevents
the terminal from being OSC-queried on startup. Additionally, OSC
queries will never be run if the process isn't in control of the
terminal, for example when started in the background / detached.
Fixes#3955.
This aborts OSC queries after a timeout, and prevents mc from getting
stuck when encountering unresponsive or non-compliant terminals, like
CircleCI's.
Fixes#3938.
mc diff <alias>/<bucket>/ ./dir/ is not calculated correctly because the
difference code relies on the format of the argument, for example,
whether it is dir/ or ./dir/ or ../my/dir/.
This commit will calculate the absolute path of the passed argument if
it is a filesystem path and uses it through the code.
This prevents mc from querying the terminal via OSC when running in a
CI context, like CircleCI. As the CI never responds to the query we
get stuck in a read we can not cancel.
Fixes#3938.
Find would replace placeholders before splitting input, meaning files with spaces would be executed as separate args.
Split before replacing args, and use shell-style parsing.
Technically, this requires quotes in input to be escaped, so to specify `--exec='echo {""}'` you must escape them like this: `--exec='echo {\"\"}'`. Quoted inputs aren't documented, but it is a change.
Errors would not be displayed, like `./mc find play/test123/ --exec='unknown {}'` would just exit. Instead it now prints `exec: "unknown": executable file not found in $PATH`.
Fixes#3906
mc diff/mirror command fails to compare source & target when doing
an S3 site-wide listing.
The reason is that client-s3.List(), when doing a site-wide listing,
lists buckets first and list objects inside each bucket with the order
returned by S3 ListBuckets API.
However this can produce a non properly sorted listing output,
e.g.:
```
$ mc ls -r myminio/
[2021-12-14 15:58:27 CET] 227KiB bucketname/object1
[2021-12-14 15:58:24 CET] 227KiB bucketname-0/object2
```
Though it should be
```
$ mc ls -r myminio/
[2021-12-14 15:58:24 CET] 227KiB bucketname-0/object2
[2021-12-14 15:58:27 CET] 227KiB bucketname/object1
```
because '/' has a higher ASCII value than '-'
This commit fixes the behavior by always sorting bucket names with
a fake trailing slash when doing a site-wide recursive listing.
it is potentially harmful when retrying
a lot of buckets where in this might
trigger a retry - continous Listing()
however this retry is not needed as the
callers restart as needed when --watch
or --active-active are used.
`mc du play` would count objects twice since it was doing a recursive listing AND travering into folders.
Compare total to `mc du play --depth=2` and `mc du play --recursive`.
mc admin heal was showing additional unnecessary entries
of nodes with empty disks listing when that node does not
belong to the current pool number. A node only belongs to
one pool, so remove the extra entries.
The earlier approach of using a license token for communicating with
SUBNET is being replaced with a simpler mechanism of API keys. Unlike
the license which is a JWT token, these API keys will be simple UUID
tokens, and don't have any embedded information in them. SUBNET would
generate the API key on cluster registration, and return in the API
response. mc then stores it in the `subnet api_key` config of minio,
to be used for subsequent communication with SUBNET.
In case the api_key is not available in the config, but the cluster's
license is available, it will be used as auth in the subnet API call,
and api_key will be set after the call succeeds. This will help in
smooth migration from older versions of MinIO.
Sometimes, with slow machines, speedtest will not able to accomplish
any PUT/GET operations though no errors is met. In that case, this
commit will show an adequate error message asking the user to increase
the --duration flag.
It contains a new field `TLSInfoAvailable` which will get added under
the `tls` node in health report, helping `health-analyzer` perform the
TLS related checks more reliably.
The writer needs to be closed before creating the request. Otherwise the
call to subnet api fails with error like:
HTTP/1.x transport connection broken: http: ContentLength=6235 with Body length 6303.
Windows users often click on the binary without
knowing `mc` is a command-line tool and should be
run from a terminal. Throw a message to guide them
on what to do.
- reach subnet, upon failure provide `--airgap` command line
to allow them to upload report manually.
- use a proper httpClient when reaching out to subnet
with a 10sec timeout, and also support custom proxies
with self signed certs.
- also fix some error messages and cleanup help with correct
wording and grammar.
When a dynamic config is reset, the minio api response has `true` as
value of the header `x-minio-config-applied`. In such cases, mc should
not show the message asking the user to restart `minio`.
Limiting tracing to a specific path requires an asterisk at the end. I
don't know if this is a regression or the example was always wrong. I
only ever figured this out by trial and error.
This fixes#3856.
Co-authored-by: Robert Lützner <robert.luetzner@iternity.com>
The command needs exactly one argument, but was allowing two and
ignoring the second if passed. Fixed the validation.
Signed-off-by: Shireesh Anjal <shireesh@minio.io>
The custom `String()` function written for the `HealthDataTypeFlag` was
resulting in a crash as it did not contain `\t` character on which the
usage gets split when printing the error message.
Fixed by reusing the `FlagStringer` from cli package, which is used by StringFlag.String() as well.
Subnet doesn't return `ContentLength` in it's api response, and hence
using it as the limit with `LimitReader` doesn't work. Fixed by using a
sufficiently large (1 MiB) limit.
By default, it will run in `online` mode and try to register the cluster
on subnet. If the subnet license is not available in minio/mc config, it
will
- ask the user for login credentials
- use the credentials for authentication and call the registration api
- get the license from response of the api and store it in config
- use the stored license for any subsequent calls
In case the user belongs to multiple organizations in subnet, they will
be prompted to choose the appropriate organization from the list.
If the client machine is in an airgapped environment, user can choose to
use the `--offline` flag when running the command. In this case, it will
- generate and print the registration token
- ask the user to paste it in the subnet registration screen
- accept the license generated by subnet and store it in config
As part of this work, the `health` sub-command is also enhanced to:
- run in `online` mode by default, which tries to upload the health
report to subnet. Here the user will be prompted for subnet credentials
(if license not available in config) _before_ generating the health
report as it is a long running process.
- support a new flag `--offline` which can be used when subnet is not
reachable. When used, the health report will be generated in a local
json.gz file, which can then be uploaded on subnet.
The examples in help text of both the sub-commands are enhanced to list
multiple use cases.
When saving license to config, first preference is given to minio
config. If the minio server supports the `subnet license` key, the
license will be stored here. In case it is an older version of minio
that doesn't support this key, then the license will be stored in mc
host config.
In case of non-distributed setup, the server doesn't return network perf
data. Because of this, the network spinner doesn't finish, and is closed
explicitly outside the loop, resulting two lines (one incomplete, one
complete) for it.
Fixed by explicitly checking the number of servers when checking for
completion of the network spinner.
In mc admin info output, it is better to show 'OK' status in yellow and
not in green when there is a failed disk or a failed network link so it
is easier for users to detect something wrong.
Perform only lightweight tests by default, and include the long running
tests only if specified through a `--full` flag in the `admin subnet
health` command.
Tag can be set directly under Filter tag and not always under
Filter.And in the lifecycle document. In that case, the tag won't be
properly showed in the tabular info of the ILM listing. This PR fixes
it.
heal info now shows the list of all MinIO nodes and the status of disks,
OK, unformatted, healing with an estimation of the time of healing
completion. It also shows the tolerance of nodes/disks, meaning how many
nodes or disks we can turn off before losing read operation in the
cluster.
The "admin info" step was moved from being the first step to the last
step in minio at some point, but the sequence of spinners in mc was not
updated with this change. Because of this, the first spinner itself used
to get stuck for the whole duration of report generation.
Fixed by correcting the sequence of spinners to make them in sync with
the processing in minio.
Signed-off-by: Shireesh Anjal <shireesh@minio.io>
Some users with low memory and good connection uploading some big files
can see memory crash, since mc will increase upload parallelism over
time when the bandwidth and the server is able to carry the load.
This PR will check the free OS memory before starting mirror/cp and will
estimate current memory usage based on uploaded objects sizes, it will
stop parallelism until the memory gets some room.
Some users struggle to remove a bucket when they don't use recommended
setups, such as NFS disks.
This command will force bucket removal in server side, using
x-minio-force-delete during DELETE bucket call.
mc ilm ls has --expiry and --transition to show for only expiry or
transition information, but if one of them doesn't exist, mc crashes.
The PR fixes this.
Co-authored-by: Anis Elleuch <anis@min.io>
The subnet health report generation now includes collection of system
errors. So add a spinner for this step too in the screen output of the
command.
Signed-off-by: Shireesh Anjal <shireesh@minio.io>
When the subnet health command from current mc is used with the MinIO
versions before the latest health data structure changes (v2) were
introduced, the generated report doesn't contain the cluster information
(minio -> info).
This is because these old versions of minio don't return this
information in the output of the `healthinfo` api.
Fixed this by explicitly pulling the server info separately when we
detect that the health schema version is not v2.
This allows triggering a resyncing of previously
replicated objects when existing object replication is
enabled. It is useful in scenarios where replication target
is entirely lost and content needs to be replicated again.
mc du will always count the size of all objects under a specified
path, du -r will show the disk usage in a more detailed fashion, but if
not specified, let's do a recursive LIST call instead of calling du()
multiple times.
Co-authored-by: Klaus Post <klauspost@gmail.com>
Print '...' instead, for a distributed cluster, other characters will
follow to indicate the status of the restart command.
Co-authored-by: Anis Elleuch <anis@min.io>
it latest release and master `mc admin bucket remote add` cannot
parse accesskeys/secretkeys with special characters such as `@`,
this is due to an incorrect implementation.
use the technique used in parsing MC_HOST_alias here to allow
for more complex use-cases.
* Add --schedule flag to subnet health command
If passed along with --license, the health diagnostics will be executed
and uploaded to Subnet at given schedule (in days).
Also, delete the generated file after succesful upload to subnet.
* Add --name flag to subnet health command
If passed along with the --license flag, this will be passed as the name
of the cluster in the subnet upload request. Subnet uses this only for
the 1st upload of the given cluster.
If not passed, the alias of the cluster will be passed as default value
for the cluster name.
Sometimes passwords are auto-generated, print them so the user can
easily copy it somewhere.
Signed-off-by: Anis Elleuch <anis@min.io>
Co-authored-by: Anis Elleuch <anis@min.io>
mc admin restart service clearly indicates to the user that restarting
the process is started and also shows progress using:
`.` in red to indicate the cluster is still offline
`!` in yellow to indicate the cluster is up but still initializing
Currently trace filters are like OR operations, but I think in debugging
we want AND instead.
Currently, --status-code 503 --path 'bucket/path' will show 503 requests or
requests with 'bucket/path', this PR will require having both conditions
in the requests in order to be shown in the trace.
In case of single server setups, the network performance data is empty.
Because of this, the condition that indicates that the network test step
is over never evaluates to true and hence the spinner doesn't finish
(doesn't show the tickmark indicating the step has completed).
While this is a nigligible issue in normal execution of the subnet
health command, it has a weird side effect when the `--license` flag is
passed. In such cases, the network test spinner finishes _after_ the
message about succesful generation of the report is printed.
Ensuring that all the spinners are stopped explicitly after the api call
returns resolves this issue.
Add an optional text flag `license` to the `subnet health`
command. If this flag is passed, upload the generated health report to
Subnet by passing the license key as auth.
* mirror: Add monitoring endpoint for mirroring operations
The following are the added metrics:
mc_mirror_failed_s3ops 3
mc_mirror_time_last_activity 9
mc_mirror_total_restarts 3
mc_mirror_total_s3ops 199920
Also, --watch automatically restarted if an error is detected
Co-authored-by: Anis Elleuch <anis@min.io>
After the introduction of versioning parameter in mc ilm document, we
didn't test mc ilm edit. This PR fixes this behavior and add more
lifecycle validation for versioning parameters
Session files contained a colored json which leaded a problem with
unparsing it, use jsoniter instead of the colorjson when marshal
unmarshal session data.
When parallel net perf tests are not performed, for example in FS mode,
the server response contains an empty node for the net pef data with
value of `addr` as empty string (`""`).
This data should be ignored when mapping the server response to the
health report format. Otherwise we end up with a health report with an
empty server node under `hardware` section.
Currently, there is a success message misleading the user, while what is
really happened is that minio-go SetLifecycle removes any existing
lifecycle configuration in the bucket.
At the moment posener/complete [1] doesn't allow specifying shell for
IsInstalled(), which might lead to confusing error messages, since it
just returns true if it's able to find completion definition in *any*
shell configurations even if it's not what the user currently uses.
Hence we should remove this check and call Install() directly, and user
can get more details in this case.
[1] https://github.com/posener/complete
* Improve auto-completion installation handling as per @ebozduman
* Improve messages when user's using an unsupported shell
* Refactors mc auto-complete logic
Co-authored-by: Ersan <ersan.bozduman@gmail.com>
also convert the filter options to slice flags, for example
if you wish to trace only for status code 404 and 503 then
you would specify the following command
```
mc admin trace --status-code 404 --status-code 503 myminio/
```
Refactor and make implementation more readable.
Add the following flags to mc ilm command:
--expired-object-delete-marker
--noncurrentversion-expiration-days
--noncurrentversion-transition-days
--noncurrentversion-transition-storage-class
Bucket creation & removal are events only supported by MinIO server and
they are not meaningful for FS. Just ignore them at FS level and avoid
reporting an error.
Remove transition targets from `mc admin bucket remote` command
and references to transition s.c label in `mc ilm add` command and docs.
This is being deprecated in favor of an improved approach
to transition in the works.
mc did not require -a to trigger mirroring of bucket policy & locking
configurations, this commit enforces this requirement. Besides, the config
mirroring will only happen if the mirror command is creating new buckets in
the target server.
Mirroring watch supports parallel manager to run actions of the received
events in parallel, but sometimes the order of the execution of those
actions matter.
For example:
- A new bucket is created
- A new file is uploaded in the new bucket
This PR will bring support of the barrier concept. A task with a barrier
will only executed after all the previous tasks finish, the
subsequent tasks will also be only executed when the barrier task is
finished.
Later, we will bring support of tasks dependency to optimize the
parallelism.
- fixes errant top level directory creation, regression introduced in #3313
- fixes `mc ls -r` regression introduced in #3476
- fixes other bugs such as `mc mirror` would perpetually hang if the
destination bucket doesn't exist, create and proceed instead.
- removes DirOpt style implementations for List, ListIncompleteUploads
these are not useful anymore.
If --versions flag is specified, instead of HEAD currently
repeated listing is being done and latest version ID reported
for all the versions instead of actual version ID.
The existing command `admin health` is being restructured to `admin
subnet health` as the reports generated by this command are primarily
intended to be uploaded to Subnet.
If user runs the `admin health` command, they'll be asked to run `admin
subnet health` command.
client S3 Stat() API tries to use HEAD requests but fall back to regular
listing when there is a permission issue with HEAD or when the object is
encrypted using SSE-C.
However the code accepts any entry from the minio-go listing API
which is wrong. It needs to only accept the object name as passed
by the the upper layer.
A code refactor made rm to invoke HEAD request instead of LIST to stat
object to remove, and this introduced a problem removing a delete-marker
since HEAD of a delete-marker returns 405 Method Not Allowed
HEAD object returns 404 with a delete-marker header when the object is a
delete-marker in a versioning bucket. This PR will show a better error
message in that case.
Use url2Stat() and ignore 400 bad request error.
`mc cat >/tmp/output` is not working properly due to mc cat versioning
changes, this commit fixes the issue to make mc cat works as expected.
It also adds a unit test for it.
Add a new field in the stat output to show if the object has any
expiration date due to lifecycle expiration rules. The expiration date
is show in machine local time.
```
mc alias set
alias remove
alias list
```
are new commands that replace mc config host sub-commands.
mc config host will still be available but hidden for backward
compatiblity. The JSON output is also kept if the user is running mc
config host command.
--rewind will go back in time and select specific object versions that are
the latest at the specified time.
--versions will display all the versions
cp will just ignore if the latest version is a delete marker
ls will print delete markers with a (deleted) at the end
app.Before receives a cli.Context but without flags parsed. There is no
point calling ctx.Bool() or ctx.IsSet() at that stage.
However, flags are parsed in commands, so minio initialization and
setting global variables (globalJSON, globalQuiet, etc..) can be moved
to the Before function of all commands.
Avoid setting command.Before for non leaf commands, otherwise Before
function will be called multiples times until it reaches the leaf
command.
`mc policy set` can confuse users by showing that a bucket has 'none'
policy mode although issuing `mc policy get` will show it is `custom`
when the bucket already other policy statements for some sub-resources.
For better UX, mc will issue another request to get the real policy
mode.
Fixes#3267. Revert commit dc430afe07
which attempted to preserve similar behavior across mc cp and mc
mirror, but introduces a regression for cp when wildcards are
specified.
```
mc config host list
mc config host add
mc config host remove
mc admin prometheus generate
```
The above mc commands generate an annoying error message complaining
about the leading slash in the alias argument.
Although alias does not support any slash or backslash, we allow the
user to enter it for convenience and the code will just clean it before
using it.
The downloaded data will be stored in [file].part.minio
first and then renamed to [file]
The code also does not behave correctly when the source
reader is not seekable. the reader is wrapped by a reader
hook and then tested if it is seekable or not, though the
reader hook is always seekable.
This fix should be backward-compatible, since strings do not need
to be initialized by default, and JSON explicitly allows it to be omitted
when empty.
Stat() is supposed to return valid information for existing
objects and existing prefixes as well.
The current mechanism issues a listing request and searches
for the object or prefix in the returned list, but this could take
time if there are a lot of entries under a parent prefix.
The new commit changes the internal behavior but not the
functional output. It issues a HEAD request first, if there
is no object then assumes it is a prefix and does listing
in order to find it.
This commit adds a new global context, monitors os signals
and cancels the global context in such cases to exit
on going process gracefully.
It will also update minio-go and adapts the code with
the new context changes in the admin API.
for copy from filesystem to objectstorage.
Avoid prefixing dirname to file on target side
when doing a `mc cp /tmp/dir myminio/bucket --r`
to make `mc mirror` and `mc cp` behavior consistent
This commit adds the first set of KMS admin
commands.
For new there is only the
`mc admin kms key status <endpoint> [key-ID]` command
that can be used to fetch status information for a
KMS master key. Listing and rotation commands are
planed.
Keep elements that are used with atomic.* functions as first element
of struct because it guarantees 64bit alignment on 32 bit machines.
atomic.* functions crash if operand is not aligned at 64bit.
See https://github.com/golang/go/issues/599
- `mc du` without args should print help like other `mc` commands
- `mc du` should behave like `du -h --max-depth=1` as default
- optional `--recursive` if they want capacity for each folder.
fixes#2871
The compression parameter is not actually used, but always guessed from the file extension.
Only guess the compression type if it is not explicitly set.
Uploading a file called `out.csv.geezipd`:
Before:
```
λ mc sql -e="SELECT * from s3object LIMIT 1" --compression=GZIP --csv-input "rd=\n,fh=USE,fd=;" local/test/out.csv.geezipd
�""���k↔��Xs��W.v� ��)��{2#��,r���:�|D▲�.��f♫��→�i�p�2l�♫��ʭ���Q��v▲�5ر�c
```
(content actually not ungzipped)
After:
```
λ mc sql -e="SELECT * from s3object LIMIT 1" --compression=GZIP --csv-input "rd=\n,fh=USE,fd=;" local/test/out.csv.geezipd
"281,1285,159625,159627,2637,20000827.0117590018,1239029,1663,-6.7535419,1533,0.53597438,8"
```
We leave validation of the compression value to the server.
```
~ mc admin config history list -n 2 myminio
RestoreId: df0ebb1e-69b0-4043-b9dd-ab54508f2897
Date: Mon, 04 Nov 2019 17:27:27 GMT
region name="us-east-1" state="on"
region name="us-east-1" state="on"
region name="us-east-1" state="on"
region name="us-east-1" state="on"
RestoreId: ecc6873a-0ed3-41f9-b03e-a2a1bab48b5f
Date: Mon, 04 Nov 2019 17:28:23 GMT
region name=us-east-1 state=off
```
Remove '.exe' (case insensitive) from executable name for consistent config folder.
Potentially breaking: If people (for whatever reason) used 'mc.exe', this will potentially break their setup.
PR #2888 bumped the minimum go version from 1.12 to 1.13 but did not
update README.md to reflect the change. This commit updates the readme
to be in line with the code.
Attempting to build `mc` from source on go 1.12 yields this error:
```
$ GO111MODULE=on go get github.com/minio/mc
go: finding github.com/minio/mc latest
package github.com/minio/mc: build constraints exclude all Go files in /home/andy/go/pkg/mod/github.com/minio/mc@v0.0.0-20191004065813-f79aefa79713
```
- mc rm doesn't fail for SSE-C encrypted objects because
we use multi-object delete - this behavior is S3 compatible
- changes needed to ensure that keys are set appropriately
when doing server side copy.
This is a BREAKING change.
- This command sets policy for user and group
- `mc admin user set-policy` is now removed.
- `mc admin uesr add` no longer accepts a policy to set on the user.
Add user info command to show groups of a user
Add set, set-json, get , get-json sub-commands.
Example:
mc policy set download s3/mybucket
mc policy set-json path-to-json-file s3/mybucket
mc policy get s3/mybucket
mc policy get-json s3/mybucket
This change is in preparation to add user-groups support to MinIO
server.
- Adds add, remove, enable/disable, list and info sub-commands for the
group command
*) Add --no-autocompletion to disable the automatic install of
the auto completion
*) Add a prompt to ask for permission to install automatic
auto completion when not installed yet
This commit removes the admin credentials command
to fix the build since github.com/minio/minio
ae002aa7241bd35d5fd9b47e8b62df2176ad2ab1 removes
the admin API for updating the admin credentials.
Remove Insufficient permission error from ignored list of errors.
Fixes#2752 - When mirror fails due to insufficient
permissions of user on a bucket, this should be
displayed
List within the statURL function considers object name as a prefix
and lists objects that have the same prefix.
currently, it errors out if the object is a subset of another object.
This PR will fix this.
Fixes#2746
Currently if authorization header is missing, then request is not displayed
This resulted in just the response being displayed, in anonymous mode.
This PR fixes that issue.
With the move to go.mod, the latest humanize package is being used.
This introduces a space between size and the unit. Manually removing the space
to make it consistent with the older mc releases.
In addition to the general bucket name created for functinal tests,
some tests inside this latter creates separated buckets but remove
them using rm command which does not support removing buckets anymore.
An error, such as, `Bad Request` when copying an object without supplied
keys is not reflected in the exit code.
This commit simplifies a bit the mirror code. It makes mirror before and
after starting to send the status to mj.status.
Currently, a single remove HEAD an object, but this latter can return
400 Bad Request when the object is encrypted and the user doesn't specify
any encryption key.
So when HEAD fail, this PR will use GET listing to find the object and
remove it if existent.
We can avoid calling HEAD in the first place and use only listing, but this
has some penality on the server.
rb was relying on client.List() to find all elements that needs to be
removed. However it doesn't include 'alias/bucket' in the listing
when 'alias/bucket' itself is passed as an argument in rb command.
This PR will always attempt to delete the passed argument as this is
what the user wants in the first place.
This PR also fixes teardown() in functional-tests.sh to remove
the bucket using rb instead rm since rm does not remove buckets
anymore.
Previously OlderThan and NewerThan was configured for day
which has been changed to Days, Hours and minutes.
Also, changed the `flag` in `find` command to be `newer-than` and `older-than` to be consistent with other commands.
Due to multi-user feature on Minio and mc adoption in
many different restrictive environments, most users disable
access to ListBuckets() calls. We can avoid such network
operations as they only add marginal value.
2019-02-28 14:23:47 -08:00
1601 changed files with 79734 additions and 479554 deletions
description:MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
There has been some amount of [requests](https://github.com/minio/mc/issues?q=is%3Aissue+midnight+commander+is%3Aclosed) on renaming this project to avoid the conflict with Midnight Commander for Unix distributions. We struggled with this, it is harder to find a name sweeter and shorter than `mc` for Minio Client.
There has been some amount of [requests](https://github.com/minio/mc/issues?q=is%3Aissue+midnight+commander+is%3Aclosed) on renaming this project to avoid the conflict with Midnight Commander for Unix distributions. We struggled with this, it is harder to find a name sweeter and shorter than `mc` for MinIO Client.
Besides `mc` is a single static binary and can reside inside your application and is fully self contained. Midnight Commander (mc) is a free software clone of Norton Commander (nc). Minio and Midnight shares no code or ideas. Only their abbreviation matches.
Besides `mc` is a single static binary and can reside inside your application and is fully self contained. Midnight Commander (mc) is a free software clone of Norton Commander (nc). MinIO and Midnight shares no code or ideas. Only their abbreviation matches.
Package managers are free to choose a different name if they like. One such solution [pointed out](https://github.com/minio/mc/issues/873#issuecomment-267583013) by one of our community members.
Minio Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
MinIO Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff, find etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
```
ls list buckets and objects
mb make a bucket
rb remove a bucket
cat display object contents
head display first 'n' lines of an object
pipe stream STDIN to an object
share generate URL for temporary access to an object
cp copy objects
mirror synchronize objects to a remote site
find search for objects
sql run sql queries on objects
stat stat contents of objects
diff list differences in object name, size, and date between buckets
rm remove objects
event manage object notifications
watch watch for object events
policy manage anonymous access to objects
admin manage minio servers
session manage saved sessions for cp command
config manage mc configuration file
update check for a new software update
version print version info
alias manage server credentials in configuration file
admin manage MinIO servers
anonymous manage anonymous access to buckets and objects
batch manage batch jobs
cp copy objects
cat display object contents
diff list differences in object name, size, and date between two buckets
du summarize disk usage recursively
encrypt manage bucket encryption config
event manage object notifications
find search for objects
get get s3 object to local
head display first 'n' lines of an object
ilm manage bucket lifecycle
idp manage MinIO IDentity Provider server configuration
license license related commands
legalhold manage legal hold for object(s)
ls list buckets and objects
mb make a bucket
mv move objects
mirror synchronize object(s) to a remote site
od measure single stream upload and download
ping perform liveness check
pipe stream STDIN to an object
put upload an object to a bucket
quota manage bucket quota
rm remove object(s)
retention set retention for object(s)
rb remove a bucket
replicate configure server side bucket replication
ready checks if the cluster is ready or not
sql run sql queries on objects
stat show object metadata
support support related commands
share generate URL for temporary access to an object
tree list buckets and objects in a tree format
tag manage tags for bucket and object(s)
undo undo PUT/DELETE operations
update update mc to latest release
version manage bucket versioning
watch listen for object notification events
```
## Docker Container
@@ -41,19 +63,34 @@ docker pull minio/mc:edge
docker run minio/mc:edge ls play
```
**Note:** Above examples run `mc` against Minio [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
**Note:** Above examples run `mc` against MinIO [_play_ environment](#test-your-setup) by default. To run `mc` against other S3 compatible servers, start the container this way:
```sh
```
docker run -it --entrypoint=/bin/sh minio/mc
```
then use the [`mc config` command](#add-a-cloud-storage-service).
then use the [`mc alias` command](#add-a-cloud-storage-service).
### GitLab CI
When using the Docker container in GitLab CI, you must [set the entrypoint to an empty string](https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#override-the-entrypoint-of-an-image).
```
deploy:
image:
name: minio/mc
entrypoint: ['']
stage: deploy
before_script:
- mc alias set minio $MINIO_HOST $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
script:
- mc cp <source> <destination>
```
## macOS
### Homebrew
Install mc packages using [Homebrew](http://brew.sh/)
Source installation is intended only for developers and advanced users. `mc update` command does not support update notifications for source based installations. Please download official releases from https://minio.io/downloads/#minio-client.
If you do not have a working Golang environment, please follow [How to install Golang](https://docs.minio.io/docs/how-to-install-golang).
Source installation is only intended for developers and advanced users. If you do not have a working Golang environment, please follow [How to install Golang](https://golang.org/doc/install). Minimum version required is [go1.22](https://golang.org/dl/#stable)
```sh
go get -d github.com/minio/mc
cd${GOPATH}/src/github.com/minio/mc
make
go install github.com/minio/mc@latest
```
## Add a Cloud Storage Service
@@ -97,26 +132,26 @@ If you are planning to use `mc` only on POSIX compatible filesystems, you may sk
To add one or more Amazon S3 compatible hosts, please follow the instructions below. `mc` stores all its configuration information in ``~/.mc/config.json`` file.
mc alias set <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY> --api <API-SIGNATURE> --path <BUCKET-LOOKUP-TYPE>
```
Alias is simply a short name to your cloud storage service. S3 end-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to "S3v4".
`<ALIAS>` is simply a short name to your cloud storage service. S3 end-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to "S3v4".
Lookup is an optional argument. It is used to indicate whether dns or path style url requests are supported by the server. It accepts "dns", "path" or "auto" as valid values. By default, it is set to "auto" and SDK automatically determines the type of url lookup to use.
Path is an optional argument. It is used to indicate whether dns or path style url requests are supported by the server. It accepts "on", "off" as valid values to enable/disable path style requests.. By default, it is set to "auto" and SDK automatically determines the type of url lookup to use.
### Example - Minio Cloud Storage
Minio server displays URL, access and secret keys.
### Example - MinIO Cloud Storage
MinIO server startup banner displays URL, access and secret keys.
```sh
mc config host add minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
mc alias set minio http://192.168.1.51 BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
### Example - Amazon S3 Cloud Storage
Get your AccessKeyID and SecretAccessKey by following [AWS Credentials Guide](http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
```sh
mc config host add s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
mc alias set s3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
**Note**: As an IAM user on Amazon S3 you need to make sure the user has full access to the buckets or set the following restricted policy for your IAM user
Get your AccessKeyID and SecretAccessKey by following [Google Credentials Guide](https://cloud.google.com/storage/docs/migrating?hl=en#keys)
```sh
mc config host add gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
mc alias set gcs https://storage.googleapis.com BKIKJAA5BMMU2RHO6IBB V8f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
```
NOTE: Google Cloud Storage only supports Legacy Signature Version 2, so you have to pick - S3v2
## Test Your Setup
`mc` is pre-configured with https://play.minio.io:9000, aliased as "play". It is a hosted Minio server for testing and development purpose. To test Amazon S3, simply replace "play" with "s3" or the alias you used at the time of setup.
`mc` is pre-configured with https://play.min.io, aliased as "play". It is a hosted MinIO server for testing and development purpose. To test Amazon S3, simply replace "play" with "s3" or the alias you used at the time of setup.
*Example:*
List all buckets from https://play.minio.io:9000
List all buckets from https://play.min.io
```sh
```
mc ls play
[2016-03-22 19:47:48 PDT] 0B my-bucketname/
[2016-03-22 22:01:07 PDT] 0B mytestbucket/
@@ -175,7 +208,7 @@ Make a bucket
`mb` command creates a new bucket.
*Example:*
```sh
```
mc mb play/mybucket
Bucket created successfully `play/mybucket`.
```
@@ -184,20 +217,17 @@ Copy Objects
`cp` command copies data from one or more sources to a target.
*Example:*
```sh
```
mc cp myobject.txt play/mybucket
myobject.txt: 14 B / 14 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.00 % 41 B/s 0
```
<a name="everyday-use"></a>
## Everyday Use
### Shell aliases
You may add shell aliases to override your common Unix tools.
```sh
```
alias ls='mc ls'
alias cp='mc cp'
alias cat='mc cat'
@@ -207,23 +237,16 @@ alias find='mc find'
```
### Shell autocompletion
In case you are using bash, zsh or fish. Shell completion is embedded by default in `mc`, to install auto-completion use `mc --autocompletion`. Restart the shell, mc will auto-complete commands as shown below.
In case you are using bash or zsh, the current shell will be automatically setup to use completion feature to suggest or auto-complete your mc commands.
fatalIf(errInvalidArgument().Trace(ctx.Args()...),"please set a proper limit, for example: '--last 5' to display last 5 logs, omit this flag to display all available logs")
fatalIf(probe.NewError(e),"Unable to make user/group policy association")
}
varemptyRespmadmin.PolicyAssociationResp
ifres.UpdatedAt.Equal(emptyResp.UpdatedAt){
// Older minio does not send a result, so we populate res manually to
// simulate a result. TODO(aditya): remove this after newer minio is
// released in a few months (Older API Deprecated in Jun 2023)
ifattach{
res.PoliciesAttached=policies
}else{
res.PoliciesDetached=policies
}
}
m:=policyAssociationMessage{
attach:attach,
Status:"success",
PoliciesAttached:res.PoliciesAttached,
PoliciesDetached:res.PoliciesDetached,
User:user,
Group:group,
}
printMsg(m)
returnnil
}
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.