Add replication commands (#3272)
`mc admin bucket replication` command manages replication targets on MinIO server `mc bucket replicate` allows setting replication configuration on the source bucket
This commit is contained in:
@@ -9421,28 +9421,28 @@ SOFTWARE.
|
||||
github.com/klauspost/readahead
|
||||
https://github.com/klauspost/readahead
|
||||
----------------------------------------------------------------
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Klaus Post
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Klaus Post
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
================================================================
|
||||
|
||||
@@ -10457,8 +10457,8 @@ https://github.com/minio/minio
|
||||
|
||||
================================================================
|
||||
|
||||
github.com/minio/minio-go/v6
|
||||
https://github.com/minio/minio-go/v6
|
||||
github.com/minio/minio-go/v7
|
||||
https://github.com/minio/minio-go/v7
|
||||
----------------------------------------------------------------
|
||||
|
||||
Apache License
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* MinIO Client (C) 2020 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/console"
|
||||
)
|
||||
|
||||
var adminBucketReplicationGetCmd = cli.Command{
|
||||
Name: "get",
|
||||
Usage: "get bucket replication target",
|
||||
Action: mainAdminBucketReplicationGet,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Get replication target on MinIO server for bucket srcbucket.
|
||||
{{.Prompt}} {{.HelpName}} myminio/srcbucket
|
||||
`,
|
||||
}
|
||||
|
||||
// checkAdminBucketReplicationGetSyntax - validate all the passed arguments
|
||||
func checkAdminBucketReplicationGetSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) != 1 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "get", 1) // last argument is exit code
|
||||
}
|
||||
}
|
||||
|
||||
// mainAdminBucketReplicationGet is the handle for "mc admin bucket replication get" command.
|
||||
func mainAdminBucketReplicationGet(ctx *cli.Context) error {
|
||||
checkAdminBucketReplicationGetSyntax(ctx)
|
||||
|
||||
// Additional command specific theme customization.
|
||||
console.SetColor("ReplicationMessage", color.New(color.FgGreen))
|
||||
console.SetColor("AccessKey", color.New(color.FgBlue))
|
||||
console.SetColor("SourceBucket", color.New(color.FgYellow))
|
||||
console.SetColor("ReplicaBucket", color.New(color.FgYellow))
|
||||
console.SetColor("ReplicaURL", color.New(color.FgHiWhite))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
_, sourceBucket := url2Alias(aliasedURL)
|
||||
|
||||
// Create a new MinIO Admin Client
|
||||
client, err := newAdminClient(aliasedURL)
|
||||
fatalIf(err, "Unable to initialize admin connection.")
|
||||
|
||||
target, e := client.GetBucketReplicationTarget(globalContext, sourceBucket)
|
||||
fatalIf(probe.NewError(e).Trace(args...), "Cannot get replication target")
|
||||
printMsg(replicationMessage{
|
||||
op: "get",
|
||||
AccessKey: target.Credentials.AccessKey,
|
||||
ReplicaBucket: target.TargetBucket,
|
||||
ReplicaURL: target.URL(),
|
||||
SourceBucket: sourceBucket,
|
||||
ReplicationARN: target.Arn,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* MinIO Client (C) 2020 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/console"
|
||||
)
|
||||
|
||||
var adminBucketReplicationRemoveCmd = cli.Command{
|
||||
Name: "remove",
|
||||
Usage: "remove configured replication target",
|
||||
Action: mainAdminBucketReplicationRemove,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Remove existing replication target for bucket srcbucket on MinIO server.
|
||||
{{.Prompt}} {{.HelpName}} myminio/srcbucket
|
||||
`,
|
||||
}
|
||||
|
||||
// checkAdminBucketReplicationRemoveSyntax - validate all the passed arguments
|
||||
func checkAdminBucketReplicationRemoveSyntax(ctx *cli.Context) {
|
||||
|
||||
if len(ctx.Args()) != 1 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "remove", 1) // last argument is exit code
|
||||
}
|
||||
}
|
||||
|
||||
// mainAdminBucketReplicationRemove is the handle for "mc admin bucket replication remove" command.
|
||||
func mainAdminBucketReplicationRemove(ctx *cli.Context) error {
|
||||
checkAdminBucketReplicationRemoveSyntax(ctx)
|
||||
|
||||
console.SetColor("ReplicationMessage", color.New(color.FgGreen))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
// Create a new MinIO Admin Client
|
||||
client, cerr := newAdminClient(aliasedURL)
|
||||
fatalIf(cerr, "Unable to initialize admin connection.")
|
||||
|
||||
_, sourceBucket := url2Alias(args[0])
|
||||
fatalIf(probe.NewError(client.SetBucketReplicationTarget(globalContext, sourceBucket, nil)).Trace(args...), "Cannot remove replication target")
|
||||
|
||||
printMsg(replicationMessage{
|
||||
op: "remove",
|
||||
SourceBucket: sourceBucket,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* MinIO Client (C) 2020 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/fatih/color"
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/mc/pkg/colorjson"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio/pkg/auth"
|
||||
"github.com/minio/minio/pkg/console"
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
)
|
||||
|
||||
var adminBucketReplicationSetFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "path-style",
|
||||
Value: "auto",
|
||||
Usage: "path style supported by the server. Valid options are '[on,off,auto]'",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "api",
|
||||
Usage: "API signature. Valid options are '[S3v4, S3v2]'",
|
||||
},
|
||||
}
|
||||
var adminBucketReplicationSetCmd = cli.Command{
|
||||
Name: "set",
|
||||
Usage: "set a new replication target",
|
||||
Action: mainAdminBucketReplicationSet,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(globalFlags, adminBucketReplicationSetFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} TARGET http(s)://ACCESSKEY:SECRETKEY@REPLICA_URL/REPLICA_BUCKET [--path | --api]
|
||||
|
||||
TARGET:
|
||||
Also called as alias/sourcebucketname
|
||||
|
||||
REPLICA_BUCKET:
|
||||
Also called as replication target bucket.
|
||||
|
||||
REPLICA_URL:
|
||||
Also called as replication endpoint.
|
||||
|
||||
ACCESSKEY:
|
||||
Also called as username.
|
||||
|
||||
SECRETKEY:
|
||||
Also called as password.
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
EXAMPLES:
|
||||
1. Set a new replication target replicabucket on https://minio2:9000 for bucket 'srcbucket' to MinIO server.
|
||||
{{.DisableHistory}}
|
||||
{{.Prompt}} {{.HelpName}} myminio/srcbucket https://foobar:foo12345@minio2:9000/replicabucket
|
||||
{{.EnableHistory}}
|
||||
`,
|
||||
}
|
||||
|
||||
// checkAdminBucketReplicationSetSyntax - validate all the passed arguments
|
||||
func checkAdminBucketReplicationSetSyntax(ctx *cli.Context) {
|
||||
argsNr := len(ctx.Args())
|
||||
if argsNr < 2 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "set", 1) // last argument is exit code
|
||||
}
|
||||
if argsNr > 2 {
|
||||
fatalIf(errInvalidArgument().Trace(ctx.Args().Tail()...),
|
||||
"Incorrect number of arguments for replication set command.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// replicationMessage container for content message structure
|
||||
type replicationMessage struct {
|
||||
op string
|
||||
Status string `json:"status"`
|
||||
AccessKey string `json:"accessKey,omitempty"`
|
||||
SecretKey string `json:"secretKey,omitempty"`
|
||||
SourceBucket string `json:"sourceBucket"`
|
||||
ReplicaURL string `json:"replicaURL,omitempty"`
|
||||
ReplicaBucket string `json:"replicaBucket,omitempty"`
|
||||
ReplicationARN string `json:"replicationARN,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
API string `json:"api,omitempty"`
|
||||
}
|
||||
|
||||
func (r replicationMessage) String() string {
|
||||
switch r.op {
|
||||
case "get":
|
||||
return console.Colorize("ReplicationMessage", "Found Replication target `"+r.ReplicaURL+"` with accessKey: "+r.AccessKey+" for "+r.SourceBucket+" -> "+r.ReplicaBucket+"\n Replication ARN = "+r.ReplicationARN)
|
||||
case "remove":
|
||||
return console.Colorize("ReplicationMessage", "Removed replication target for `"+r.SourceBucket+"` bucket successfully.")
|
||||
case "set":
|
||||
return console.Colorize("ReplicationMessage", "Replication ARN = `"+r.ReplicationARN+"`.")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (r replicationMessage) JSON() string {
|
||||
r.Status = "success"
|
||||
jsonMessageBytes, e := json.MarshalIndent(r, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
|
||||
return string(jsonMessageBytes)
|
||||
}
|
||||
|
||||
// isValidPath - validates if bucket path is of valid type
|
||||
func isValidPath(path string) (ok bool) {
|
||||
l := strings.ToLower(strings.TrimSpace(path))
|
||||
for _, v := range []string{"on", "off", "auto"} {
|
||||
if l == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// fetchReplicationTarget - returns the dest bucket, dest endpoint, access and secret key
|
||||
func fetchReplicationTarget(cli *cli.Context) (sourceBucket string, replTarget *madmin.BucketReplicationTarget, err error) {
|
||||
args := cli.Args()
|
||||
argCount := len(args)
|
||||
if argCount < 2 {
|
||||
return sourceBucket, replTarget, fmt.Errorf("Missing replication target configuration")
|
||||
}
|
||||
_, sourceBucket = url2Alias(args[0])
|
||||
replicaURL := args[1]
|
||||
api := cli.String("api")
|
||||
if api != "" && !isValidAPI(api) { // Empty value set to default "S3v4".
|
||||
fatalIf(errInvalidArgument().Trace(api),
|
||||
"Unrecognized API signature. Valid options are `[S3v4, S3v2]`.")
|
||||
}
|
||||
path := cli.String("path-style")
|
||||
if !isValidPath(path) {
|
||||
fatalIf(errInvalidArgument().Trace(path),
|
||||
"Unrecognized bucket path style. Valid options are `[on,off, auto]`.")
|
||||
}
|
||||
u, cerr := url.Parse(replicaURL)
|
||||
if cerr != nil {
|
||||
fatalIf(probe.NewError(cerr), "Malformed replication target URL")
|
||||
}
|
||||
isSSL := u.Scheme == "https"
|
||||
accessKey := u.User.Username()
|
||||
secretKey, _ := u.User.Password()
|
||||
replicaBucket := strings.TrimPrefix(u.Path, slashSeperator)
|
||||
replicaBucket = strings.TrimSuffix(replicaBucket, slashSeperator)
|
||||
|
||||
console.SetColor(cred, color.New(color.FgYellow, color.Italic))
|
||||
creds := &auth.Credentials{AccessKey: accessKey, SecretKey: secretKey}
|
||||
replTarget = &madmin.BucketReplicationTarget{TargetBucket: replicaBucket, IsSSL: isSSL, Credentials: creds, Endpoint: u.Host, Path: path, API: api}
|
||||
return sourceBucket, replTarget, nil
|
||||
}
|
||||
|
||||
// mainAdminBucketReplicationSet is the handle for "mc admin bucket replication set" command.
|
||||
func mainAdminBucketReplicationSet(ctx *cli.Context) error {
|
||||
checkAdminBucketReplicationSetSyntax(ctx)
|
||||
|
||||
console.SetColor("ReplicationMessage", color.New(color.FgGreen))
|
||||
|
||||
// Get the alias parameter from cli
|
||||
args := ctx.Args()
|
||||
aliasedURL := args.Get(0)
|
||||
// Create a new MinIO Admin Client
|
||||
client, cerr := newAdminClient(aliasedURL)
|
||||
fatalIf(cerr, "Unable to initialize admin connection.")
|
||||
|
||||
sourceBucket, replTarget, perr := fetchReplicationTarget(ctx)
|
||||
fatalIf(probe.NewError(perr), "Unable to parse input arguments.")
|
||||
fatalIf(probe.NewError(client.SetBucketReplicationTarget(globalContext, sourceBucket, replTarget)).Trace(args...), "Cannot add new replication target")
|
||||
arn, e := client.GetBucketReplicationARN(globalContext, replTarget.URL())
|
||||
fatalIf(probe.NewError(e), "Replication ARN missing")
|
||||
|
||||
printMsg(replicationMessage{
|
||||
op: "set",
|
||||
ReplicaURL: replTarget.URL(),
|
||||
ReplicaBucket: replTarget.TargetBucket,
|
||||
AccessKey: replTarget.Credentials.AccessKey,
|
||||
SourceBucket: sourceBucket,
|
||||
ReplicationARN: arn,
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MinIO Client (C) 2020 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import "github.com/minio/cli"
|
||||
|
||||
var adminBucketReplicationCmd = cli.Command{
|
||||
Name: "replication",
|
||||
Usage: "Manage replication targets",
|
||||
Action: mainAdminBucketReplication,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: globalFlags,
|
||||
Subcommands: []cli.Command{
|
||||
adminBucketReplicationSetCmd,
|
||||
adminBucketReplicationGetCmd,
|
||||
adminBucketReplicationRemoveCmd,
|
||||
},
|
||||
HideHelpCommand: true,
|
||||
}
|
||||
|
||||
// mainAdminBucketReplication is the handle for "mc admin bucket replication" command.
|
||||
func mainAdminBucketReplication(ctx *cli.Context) error {
|
||||
cli.ShowCommandHelp(ctx, ctx.Args().First())
|
||||
return nil
|
||||
// Sub-commands like "set", "get" have their own main.
|
||||
}
|
||||
+2
-1
@@ -26,6 +26,7 @@ var adminBucketCmd = cli.Command{
|
||||
Flags: globalFlags,
|
||||
Subcommands: []cli.Command{
|
||||
adminBucketQuotaCmd,
|
||||
adminBucketReplicationCmd,
|
||||
},
|
||||
HideHelpCommand: true,
|
||||
}
|
||||
@@ -34,5 +35,5 @@ var adminBucketCmd = cli.Command{
|
||||
func mainAdminBucket(ctx *cli.Context) error {
|
||||
cli.ShowCommandHelp(ctx, ctx.Args().First())
|
||||
return nil
|
||||
// Sub-commands like "quota", "usage" have their own main.
|
||||
// Sub-commands like "quota", "replication" have their own main.
|
||||
}
|
||||
|
||||
@@ -264,7 +264,8 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/share/list": nil,
|
||||
"/share/upload": s3Completer,
|
||||
|
||||
"/bucket/version": s3Completer,
|
||||
"/bucket/replicate": s3Completer,
|
||||
"/bucket/version": s3Completer,
|
||||
|
||||
// Admin API commands MinIO only.
|
||||
"/admin/heal": s3Completer,
|
||||
@@ -312,9 +313,11 @@ var completeCmds = map[string]complete.Predictor{
|
||||
"/admin/group/remove": aliasCompleter,
|
||||
"/admin/group/info": aliasCompleter,
|
||||
|
||||
"/config/host/add": nil,
|
||||
"/config/host/list": aliasCompleter,
|
||||
"/config/host/remove": aliasCompleter,
|
||||
"/admin/bucket/replication": aliasCompleter,
|
||||
"/admin/bucket/remote": aliasCompleter,
|
||||
"/config/host/add": nil,
|
||||
"/config/host/list": aliasCompleter,
|
||||
"/config/host/remove": aliasCompleter,
|
||||
|
||||
"/update": nil,
|
||||
"/version": nil,
|
||||
|
||||
@@ -31,6 +31,7 @@ var bucketCmd = cli.Command{
|
||||
Flags: append(bucketFlags, globalFlags...),
|
||||
Subcommands: []cli.Command{
|
||||
bucketLockCmd,
|
||||
bucketReplicateCmd,
|
||||
bucketVersionCmd,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import (
|
||||
minio "github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/encrypt"
|
||||
"github.com/minio/minio-go/v7/pkg/lifecycle"
|
||||
"github.com/minio/minio-go/v7/pkg/replication"
|
||||
)
|
||||
|
||||
// filesystem client
|
||||
@@ -1144,3 +1145,28 @@ func (f *fsClient) SetVersioning(ctx context.Context, status string) *probe.Erro
|
||||
APIType: "filesystem",
|
||||
})
|
||||
}
|
||||
|
||||
// Get replication configuration for a given bucket, not implemented.
|
||||
func (f *fsClient) GetReplication(ctx context.Context) (replication.Config, *probe.Error) {
|
||||
return replication.Config{}, probe.NewError(APINotImplemented{
|
||||
API: "GetReplication",
|
||||
APIType: "filesystem",
|
||||
})
|
||||
}
|
||||
|
||||
// Set replication configuration for a given bucket, not implemented.
|
||||
func (f *fsClient) SetReplication(ctx context.Context, cfg *replication.Config) *probe.Error {
|
||||
return probe.NewError(APINotImplemented{
|
||||
API: "SetReplication",
|
||||
APIType: "filesystem",
|
||||
})
|
||||
}
|
||||
|
||||
// Remove replication configuration for a given bucket. Not implemented
|
||||
func (f *fsClient) RemoveReplication(ctx context.Context) *probe.Error {
|
||||
return probe.NewError(APINotImplemented{
|
||||
API: "RemoveReplication",
|
||||
APIType: "filesystem",
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import (
|
||||
"github.com/minio/minio-go/v7/pkg/lifecycle"
|
||||
"github.com/minio/minio-go/v7/pkg/notification"
|
||||
"github.com/minio/minio-go/v7/pkg/policy"
|
||||
"github.com/minio/minio-go/v7/pkg/replication"
|
||||
"github.com/minio/minio-go/v7/pkg/s3utils"
|
||||
"github.com/minio/minio-go/v7/pkg/tags"
|
||||
"github.com/minio/minio/pkg/mimedb"
|
||||
@@ -2407,3 +2408,41 @@ func (c *S3Client) SetVersioning(ctx context.Context, status string) *probe.Erro
|
||||
}
|
||||
return probe.NewError(err)
|
||||
}
|
||||
|
||||
// GetReplication - gets replication configuration for a given bucket.
|
||||
func (c *S3Client) GetReplication(ctx context.Context) (replication.Config, *probe.Error) {
|
||||
bucket, _ := c.url2BucketAndObject()
|
||||
if bucket == "" {
|
||||
return replication.Config{}, probe.NewError(BucketNameEmpty{})
|
||||
}
|
||||
|
||||
replicationCfg, e := c.api.GetBucketReplication(ctx, bucket)
|
||||
if e != nil {
|
||||
return replication.Config{}, probe.NewError(e)
|
||||
}
|
||||
return replicationCfg, nil
|
||||
}
|
||||
|
||||
// RemoveReplication - removes replication configuration for a given bucket.
|
||||
func (c *S3Client) RemoveReplication(ctx context.Context) *probe.Error {
|
||||
bucket, _ := c.url2BucketAndObject()
|
||||
if bucket == "" {
|
||||
return probe.NewError(BucketNameEmpty{})
|
||||
}
|
||||
|
||||
e := c.api.RemoveBucketReplication(ctx, bucket)
|
||||
return probe.NewError(e)
|
||||
}
|
||||
|
||||
// SetReplication sets replication configuration for a given bucket.
|
||||
func (c *S3Client) SetReplication(ctx context.Context, cfg *replication.Config) *probe.Error {
|
||||
bucket, _ := c.url2BucketAndObject()
|
||||
if bucket == "" {
|
||||
return probe.NewError(BucketNameEmpty{})
|
||||
}
|
||||
|
||||
if e := c.api.SetBucketReplication(ctx, bucket, *cfg); e != nil {
|
||||
return probe.NewError(e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
minio "github.com/minio/minio-go/v7"
|
||||
"github.com/minio/minio-go/v7/pkg/encrypt"
|
||||
"github.com/minio/minio-go/v7/pkg/lifecycle"
|
||||
"github.com/minio/minio-go/v7/pkg/replication"
|
||||
)
|
||||
|
||||
// DirOpt - list directory option.
|
||||
@@ -138,6 +139,10 @@ type Client interface {
|
||||
// Versioning operations
|
||||
GetVersioning(ctx context.Context) (minio.BucketVersioningConfiguration, *probe.Error)
|
||||
SetVersioning(ctx context.Context, status string) *probe.Error
|
||||
// Replication operations
|
||||
GetReplication(ctx context.Context) (replication.Config, *probe.Error)
|
||||
SetReplication(ctx context.Context, cfg *replication.Config) *probe.Error
|
||||
RemoveReplication(ctx context.Context) *probe.Error
|
||||
}
|
||||
|
||||
// ClientContent - Content container for content metadata
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* MinIO Client (C) 2020 MinIO, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/fatih/color"
|
||||
|
||||
"github.com/minio/cli"
|
||||
json "github.com/minio/mc/pkg/colorjson"
|
||||
"github.com/minio/mc/pkg/probe"
|
||||
"github.com/minio/minio-go/v7/pkg/replication"
|
||||
"github.com/minio/minio/pkg/console"
|
||||
)
|
||||
|
||||
var bucketReplicateCmd = cli.Command{
|
||||
Name: "replicate",
|
||||
Usage: "configure bucket replication",
|
||||
Action: mainReplicate,
|
||||
Before: setGlobalsFromContext,
|
||||
Flags: append(replicateFlags, globalFlags...),
|
||||
CustomHelpTemplate: `NAME:
|
||||
{{.HelpName}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.HelpName}} [COMMAND FLAGS] TARGET
|
||||
|
||||
FLAGS:
|
||||
{{range .VisibleFlags}}{{.}}
|
||||
{{end}}
|
||||
DESCRIPTION:
|
||||
Manage replication configuration on the bucket.
|
||||
|
||||
EXAMPLES:
|
||||
1. Add a replication configuration to the "devices" bucket
|
||||
{{.Prompt}} {{.HelpName}} myminio/devices --config "config.json"
|
||||
|
||||
2. List replication configuration on the "devices" bucket
|
||||
{{.Prompt}} {{.HelpName}} myminio/devices
|
||||
|
||||
3. Clear replication configuration on the "devices" bucket
|
||||
{{.Prompt}} {{.HelpName}} myminio/devices --clear
|
||||
`,
|
||||
}
|
||||
|
||||
var replicateFlags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
Name: "config",
|
||||
Usage: "add a config.json with replication configuration",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "clear",
|
||||
Usage: "remove replication configuration",
|
||||
},
|
||||
}
|
||||
|
||||
type replicateMessage struct {
|
||||
Op string `json:"-"`
|
||||
Status string `json:"status"`
|
||||
Source string `json:"source"`
|
||||
ReplicationConfig replication.Config `json:"replicationConfig,omitempty"`
|
||||
}
|
||||
|
||||
func (r replicateMessage) String() string {
|
||||
switch r.Op {
|
||||
case "Add":
|
||||
return console.Colorize("ReplicateMessage", "Replication configuration added successfully to "+r.Source+".")
|
||||
case "Remove":
|
||||
return console.Colorize("ReplicateMessage", "Replication configuration removed successfully from "+r.Source+".")
|
||||
default:
|
||||
if r.ReplicationConfig.Empty() {
|
||||
return console.Colorize("ReplicateNMessage", "No replication configuration found for "+r.Source+".")
|
||||
}
|
||||
msgBytes, e := json.MarshalIndent(r.ReplicationConfig, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal replication configuration")
|
||||
return string(msgBytes)
|
||||
}
|
||||
}
|
||||
|
||||
func (r replicateMessage) JSON() string {
|
||||
msgBytes, e := json.MarshalIndent(r, "", " ")
|
||||
fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
|
||||
return string(msgBytes)
|
||||
}
|
||||
|
||||
// Validate user given arguments
|
||||
func checkReplicateSyntax(ctx *cli.Context) {
|
||||
if len(ctx.Args()) < 1 {
|
||||
cli.ShowCommandHelpAndExit(ctx, "replicate", globalErrorExitStatus)
|
||||
}
|
||||
|
||||
if ctx.IsSet("config") && ctx.String("config") == "" {
|
||||
fatalIf(errInvalidArgument(), "config cannot be empty, please refer mc "+ctx.Command.FullName()+" --help for more details")
|
||||
}
|
||||
}
|
||||
|
||||
// getReplicateArgs - returns the replication config and replication ARN
|
||||
func getReplicateArgs(cli *cli.Context) (replConfig replication.Config, err error) {
|
||||
if !cli.IsSet("config") {
|
||||
return replConfig, nil
|
||||
}
|
||||
if cli.IsSet("clear") {
|
||||
return replConfig, fmt.Errorf("clear flag must be passed with target alone")
|
||||
}
|
||||
cfgFile := cli.String("config")
|
||||
fileReader, e := os.Open(cfgFile)
|
||||
if e != nil {
|
||||
return replConfig, fmt.Errorf("Unable to open config `" + cfgFile + "`.")
|
||||
}
|
||||
defer fileReader.Close()
|
||||
|
||||
const maxJSONSize = 120 * 1024 // 120KiB
|
||||
configBuf, err := ioutil.ReadAll(fileReader)
|
||||
if err != nil {
|
||||
return replConfig, err
|
||||
}
|
||||
if len(configBuf) > maxJSONSize {
|
||||
return replConfig, bytes.ErrTooLarge
|
||||
}
|
||||
|
||||
e = json.Unmarshal(configBuf, &replConfig)
|
||||
if e != nil {
|
||||
return replConfig, e
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func mainReplicate(cliCtx *cli.Context) error {
|
||||
ctx, cancelReplicate := context.WithCancel(globalContext)
|
||||
defer cancelReplicate()
|
||||
checkReplicateSyntax(cliCtx)
|
||||
console.SetColor("ReplicateMessage", color.New(color.FgGreen))
|
||||
console.SetColor("ReplicateNMessage", color.New(color.FgRed))
|
||||
|
||||
args := cliCtx.Args()
|
||||
urlStr := args.Get(0)
|
||||
client, err := newClient(urlStr)
|
||||
fatalIf(err.Trace(urlStr), "Unable to initialize client for "+urlStr)
|
||||
replConfig, cerr := getReplicateArgs(cliCtx)
|
||||
fatalIf(probe.NewError(cerr), "Unable to parse input arguments.")
|
||||
var op string
|
||||
if !replConfig.Empty() {
|
||||
op = "Add"
|
||||
// Configuration that is already set.
|
||||
err = client.SetReplication(ctx, &replConfig)
|
||||
fatalIf(err.Trace(args...), "Unable to set replication configuration for "+urlStr)
|
||||
|
||||
} else if cliCtx.IsSet("clear") {
|
||||
op = "Remove"
|
||||
err = client.RemoveReplication(ctx)
|
||||
fatalIf(err.Trace(args...), "Unable to remove replication configuration for "+urlStr)
|
||||
} else {
|
||||
replConfig, err = client.GetReplication(ctx)
|
||||
fatalIf(err.Trace(args...), "Unable to get replication configuration for "+urlStr)
|
||||
}
|
||||
printMsg(replicateMessage{
|
||||
Op: op,
|
||||
Status: "success",
|
||||
Source: urlStr,
|
||||
ReplicationConfig: replConfig,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@@ -143,7 +143,7 @@ func saveSharedURL(objectURL string, shareURL string, expiry time.Duration, cont
|
||||
}
|
||||
|
||||
// doShareUploadURL uploads files to the target.
|
||||
func doShareUploadURL(objectURL string, isRecursive bool, expiry time.Duration, contentType string) *probe.Error {
|
||||
func doShareUploadURL(ctx context.Context, objectURL string, isRecursive bool, expiry time.Duration, contentType string) *probe.Error {
|
||||
clnt, err := newClient(objectURL)
|
||||
if err != nil {
|
||||
return err.Trace(objectURL)
|
||||
@@ -176,10 +176,12 @@ func doShareUploadURL(objectURL string, isRecursive bool, expiry time.Duration,
|
||||
}
|
||||
|
||||
// main for share upload command.
|
||||
func mainShareUpload(ctx *cli.Context) error {
|
||||
func mainShareUpload(cliCtx *cli.Context) error {
|
||||
ctx, cancelShareDownload := context.WithCancel(globalContext)
|
||||
defer cancelShareDownload()
|
||||
|
||||
// check input arguments.
|
||||
checkShareUploadSyntax(ctx)
|
||||
checkShareUploadSyntax(cliCtx)
|
||||
|
||||
// Initialize share config folder.
|
||||
initShareConfig()
|
||||
@@ -188,18 +190,18 @@ func mainShareUpload(ctx *cli.Context) error {
|
||||
shareSetColor()
|
||||
|
||||
// Set command flags from context.
|
||||
isRecursive := ctx.Bool("recursive")
|
||||
expireArg := ctx.String("expire")
|
||||
isRecursive := cliCtx.Bool("recursive")
|
||||
expireArg := cliCtx.String("expire")
|
||||
expiry := shareDefaultExpiry
|
||||
contentType := ctx.String("content-type")
|
||||
contentType := cliCtx.String("content-type")
|
||||
if expireArg != "" {
|
||||
var e error
|
||||
expiry, e = time.ParseDuration(expireArg)
|
||||
fatalIf(probe.NewError(e), "Unable to parse expire=`"+expireArg+"`.")
|
||||
}
|
||||
|
||||
for _, targetURL := range ctx.Args() {
|
||||
err := doShareUploadURL(targetURL, isRecursive, expiry, contentType)
|
||||
for _, targetURL := range cliCtx.Args() {
|
||||
err := doShareUploadURL(ctx, targetURL, isRecursive, expiry, contentType)
|
||||
if err != nil {
|
||||
switch err.ToGoError().(type) {
|
||||
case APINotImplemented:
|
||||
|
||||
@@ -17,6 +17,8 @@ trace show http trace for MinIO server
|
||||
console show console logs for MinIO server
|
||||
prometheus manages prometheus config
|
||||
kms perform KMS management operations
|
||||
bucket manage buckets defined in the MinIO server
|
||||
|
||||
```
|
||||
|
||||
## 1. Download MinIO Client
|
||||
@@ -307,6 +309,7 @@ Skip SSL certificate verification.
|
||||
| [**trace** - show http trace for MinIO server](#trace) |
|
||||
| [**console** - show console logs for MinIO server](#console) |
|
||||
| [**prometheus** - manages prometheus config settings](#prometheus) |
|
||||
| [**bucket** - manages buckets defined in the MinIO server](#bucket) |
|
||||
|
||||
<a name="update"></a>
|
||||
### Command `update` - updates all MinIO servers
|
||||
@@ -732,7 +735,7 @@ mc admin trace myminio
|
||||
172.16.238.1 Host: 172.16.238.3:9000
|
||||
172.16.238.1 X-Amz-Date: 20190123T231705Z
|
||||
172.16.238.1 Authorization: AWS4-HMAC-SHA256 Credential=minio/20190123/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=8385097f264efaf1b71a9b56514b8166bb0a03af8552f83e2658f877776c46b3
|
||||
172.16.238.1 User-Agent: MinIO (linux; amd64) minio-go/v6.0.8 mc/2019-01-23T23:15:38Z
|
||||
172.16.238.1 User-Agent: MinIO (linux; amd64) minio-go/v7.0.8 mc/2019-01-23T23:15:38Z
|
||||
172.16.238.1 X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
|
||||
172.16.238.1
|
||||
172.16.238.1 <BODY>
|
||||
@@ -852,7 +855,7 @@ Key: test-key-1
|
||||
• Encryption ✔
|
||||
• Decryption ✔
|
||||
```
|
||||
|
||||
<a name = "bucket"></a>
|
||||
<a name="quota"></a>
|
||||
### Command `quota` - Set/Get bucket quota
|
||||
`quota` command to set or get bucket quota on MinIO server.
|
||||
@@ -889,3 +892,48 @@ mc admin bucket quota myminio/mybucket --hard 64MB
|
||||
```
|
||||
mc admin bucket quota myminio/mybucket --clear
|
||||
```
|
||||
|
||||
<a name="replication"></a>
|
||||
### Command `replication` - Set/Get/Remove bucket replication target
|
||||
`replication` command to set or get bucket replication target on MinIO server.
|
||||
|
||||
```
|
||||
NAME:
|
||||
mc admin bucket replication - manage bucket replication
|
||||
|
||||
USAGE:
|
||||
mc admin bucket replication set TARGET http(s)://ACCESSKEY:SECRETKEY@REPLICA_URL/REPLICA_BUCKET [--path | --api]
|
||||
|
||||
REPLICA_BUCKET:
|
||||
Also called as replication target bucket.
|
||||
|
||||
REPLICA_URL:
|
||||
Also called as replication endpoint.
|
||||
|
||||
ACCESSKEY:
|
||||
Also called as username.
|
||||
|
||||
SECRETKEY:
|
||||
Also called as password.
|
||||
|
||||
|
||||
```
|
||||
*Example: Set a new replication target `ReplicaBucket` on `https://minio2:9000` for bucket `srcbucket` on MinIO server. `foobar` and `foo12345` are credentials to replication endpoint.
|
||||
*
|
||||
|
||||
```
|
||||
mc admin bucket replication set myminio/srcbucket https://foobar:foobar12345@minio2:9000/ReplicaBucket --path ON --api s3v4
|
||||
Replication ARN = `arn:minio:s3::a5aefe40-1b81-4a6d-b5f6-eeee1e703459:*`
|
||||
```
|
||||
|
||||
*Example: Get replication target configured for bucket 'srcbucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc admin bucket replication get myminio/srcbucket
|
||||
```
|
||||
|
||||
*Example: Remove bucket replication target configured for bucket 'srcbucket' on MinIO.*
|
||||
|
||||
```
|
||||
mc admin bucket replication remove myminio/srcbucket
|
||||
```
|
||||
@@ -25,6 +25,7 @@ diff list differences in object name, size, and date between two buckets
|
||||
rm remove objects
|
||||
event configure object notifications
|
||||
ilm configure bucket lifecycle
|
||||
bucket manage bucket(s)
|
||||
watch listen for object notification events
|
||||
policy manage anonymous access to buckets and objects
|
||||
tag manage tags for bucket(s) and object(s)
|
||||
@@ -302,8 +303,8 @@ mc version RELEASE.2020-04-25T00-43-23Z
|
||||
| [**ls** - list buckets and objects](#ls) | [**tree** - list buckets and objects in a tree format](#tree) | [**mb** - make a bucket](#mb) | [**cat** - display object contents](#cat) |
|
||||
| [**cp** - copy objects](#cp) | [**rb** - remove a bucket](#rb) | [**pipe** - stream STDIN to an object](#pipe) | [**version** - manage bucket version](#version) |
|
||||
| [**share** - generate URL for temporary access to an object](#share) | [**rm** - remove objects](#rm) | [**find** - find files and objects](#find) | |
|
||||
| [**diff** - list differences in object name, size, and date between two buckets](#diff) | [**mirror** - synchronize object(s) to a remote site](#mirror) | [**ilm** - configure bucket lifecycle] (#ilm) | |
|
||||
| [**config** - manage config file](#config) | [**policy** - set public policy on bucket or prefix](#policy) | [**event** - manage events on your buckets](#event) | |
|
||||
| [**diff** - list differences in object name, size, and date between two buckets](#diff) | [**mirror** - synchronize object(s) to a remote site](#mirror) | [**ilm** - configure bucket lifecycle](#ilm) | |
|
||||
| [**config** - manage config file](#config) | [**policy** - set public policy on bucket or prefix](#policy) | [**event** - manage events on your buckets](#event) |[**replicate** - configure bucket replication](#replicate) |
|
||||
| [**update** - manage software updates](#update) | [**watch** - watch for events](#watch) | [**stat** - stat contents of objects and folders](#stat) | |
|
||||
| [**head** - display first 'n' lines of an object](#head) | [**lock** - set and get object lock configuration](#lock) | [**retention** - set retention for object(s)](#retention) | |
|
||||
| [**mv** - move objects](#mv) | [**sql** - run sql queries on objects](#sql) | [**legalhold** - set legal hold for object(s)](#legalhold) | |
|
||||
@@ -1357,6 +1358,82 @@ mc tag remove s3/testbucket/testobject
|
||||
Tags removed for s3/testbucket/testobject.
|
||||
```
|
||||
|
||||
<a name="replicate"></a>
|
||||
### Command `replicate`
|
||||
`replicate` command provides a convenient way to set, remove, and list bucket replication configuration.
|
||||
|
||||
```
|
||||
USAGE:
|
||||
mc bucket replicate [COMMAND FLAGS | -h] TARGET
|
||||
|
||||
FLAGS:
|
||||
--config value add a config.json with replication configuration
|
||||
--clear remove replication configuration
|
||||
--help, -h show help
|
||||
--json enable JSON formatted output
|
||||
--debug enable debug output
|
||||
```
|
||||
|
||||
*Example : Set replication configuration on a bucket. The replication configuration needs to be in json format. If replication configuration is being set on MinIO, the config json should have a ReplicationArn tag. An admin user should have configured a replication target for the replication endpoint and provided a ARN via `mc admin bucket replication set` and `mc admin bucket remote` commands*
|
||||
|
||||
Set replication configuration in `config.json` with replication ARN `arn:minio:s3::598361bf-3cec-49a7-b529-ce870a34d759:*` on `testbucket` in alias `myminio`
|
||||
```
|
||||
$ cat config.json
|
||||
{
|
||||
"ReplicationArn":"arn:minio:s3::598361bf-3cec-49a7-b529-ce870a34d759:*",
|
||||
"Rules": [
|
||||
{
|
||||
"Status": "Enabled",
|
||||
"Priority": 1,
|
||||
"DeleteMarkerReplication": { "Status": "Disabled" },
|
||||
"Filter" : { "Prefix": "Tax"},
|
||||
"Destination": {
|
||||
"Bucket": "arn:aws:s3:::destbucket",
|
||||
"StorageClass":"STANDARD"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
mc bucket replicate myminio/testbucket --config "config.json"
|
||||
Replication configuration added successfully to myminio/testbucket.
|
||||
```
|
||||
|
||||
*Example : List replication configuration for a bucket*
|
||||
|
||||
List replication configuration for `testbucket` in alias `myminio`
|
||||
```
|
||||
mc bucket replicate myminio/testbucket
|
||||
{
|
||||
"ReplicationArn": "arn:minio:s3::95e989fc-3d02-49f1-8d92-9c024926ce30:*",
|
||||
"Rules": [
|
||||
{
|
||||
"ID": "",
|
||||
"Status": "Enabled",
|
||||
"Priority": 1,
|
||||
"DeleteMarkerReplication": {
|
||||
"Status": "Disabled"
|
||||
},
|
||||
"Destination": {
|
||||
"Bucket": "arn:aws:s3:::destbucket",
|
||||
"StorageClass": "STANDARD"
|
||||
},
|
||||
"Filter": {
|
||||
"Prefix": "Tax",
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
*Example : Remove replication configuration on a bucket*
|
||||
|
||||
Remove replication configuration on `testbucket` in alias `myminio`
|
||||
```
|
||||
mc bucket replicate myminio/testbucket --clear
|
||||
Replication configuration removed successfully from myminio/testbucket.
|
||||
```
|
||||
|
||||
<a name="admin"></a>
|
||||
### Command `admin`
|
||||
Please visit [here](https://docs.min.io/docs/minio-admin-complete-guide) for a more comprehensive admin guide.
|
||||
|
||||
@@ -3,24 +3,24 @@ module github.com/minio/mc
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||
github.com/cheggaaa/pb v1.0.28
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/go-ini/ini v1.57.0 // indirect
|
||||
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
|
||||
github.com/klauspost/compress v1.10.3
|
||||
github.com/mattn/go-ieproxy v0.0.1
|
||||
github.com/mattn/go-isatty v0.0.8
|
||||
github.com/minio/cli v1.22.0
|
||||
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67
|
||||
github.com/minio/minio v0.0.0-20200722004956-c43da3005ae8
|
||||
github.com/minio/minio-go/v7 v7.0.2-0.20200722162308-e0105ca08252
|
||||
github.com/minio/sha256-simd v0.1.1
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||
github.com/pkg/profile v1.3.0
|
||||
github.com/pkg/xattr v0.4.1
|
||||
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953
|
||||
github.com/posener/complete v1.2.3
|
||||
github.com/rjeczalik/notify v0.9.2
|
||||
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381
|
||||
@@ -30,3 +30,5 @@ require (
|
||||
gopkg.in/h2non/filetype.v1 v1.0.5
|
||||
gopkg.in/yaml.v2 v2.2.8
|
||||
)
|
||||
|
||||
replace go.etcd.io/etcd/v3 => go.etcd.io/etcd/v3 v3.3.0-rc.0.0.20200707003333-58bb8ae09f8e
|
||||
|
||||
@@ -277,9 +277,8 @@ github.com/minio/highwayhash v1.0.0 h1:iMSDhgUILCr0TNm8LWlSjF8N0ZIj2qbO8WHp6Q/J2
|
||||
github.com/minio/highwayhash v1.0.0/go.mod h1:xQboMTeM9nY9v/LlAOxFctujiv5+Aq2hR5dxBpaMbdc=
|
||||
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
|
||||
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
|
||||
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67 h1:xMg87xvLhrw2jeE6xGx/uuFr2iIksfszITGdHhWURnA=
|
||||
github.com/minio/minio v0.0.0-20200714163805-778e9c864f67/go.mod h1:0WThPBMICOt5eEGT3XyaUy0cxYmoGhmJEvvRbiVqbYU=
|
||||
github.com/minio/minio-go/v7 v7.0.0-20200623213017-e5cd2d129325 h1:SJ3QejG6/fa4vbiF095NoP8uZsJHLYEnKvP79mZT8uA=
|
||||
github.com/minio/minio v0.0.0-20200722004956-c43da3005ae8 h1:GnSYux9QQaVy/OBEg1/PsNdu+DoGP0J6c7Re3qq+9O0=
|
||||
github.com/minio/minio v0.0.0-20200722004956-c43da3005ae8/go.mod h1:Eu2KC2p+vW03rnYY/6R/D+QduPB7/j4kBaVA/EDLjWM=
|
||||
github.com/minio/minio-go/v7 v7.0.0-20200714085548-47e386e2cde8 h1:Xh5yHlXj/367YMabi7tWHol1AslXcuAFWaedBtGgbU0=
|
||||
github.com/minio/minio-go/v7 v7.0.0-20200714085548-47e386e2cde8/go.mod h1:QTstSRgetEDVpqiEpFniLoCslH4d9cNAa4BtjuRQrwE=
|
||||
github.com/minio/minio-go/v7 v7.0.1 h1:sL2y4uuNUEi7AjvWjoGyDFQKFX2zA0DU2tGM9m3s5f8=
|
||||
@@ -307,6 +306,7 @@ github.com/mmcloughlin/avo v0.0.0-20200523190732-4439b6b2c061/go.mod h1:wqKykBG2
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
@@ -348,6 +348,8 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/profile v1.3.0 h1:OQIvuDgm00gWVWGTf4m4mCt6W1/0YqU7Ntg0mySWgaI=
|
||||
github.com/pkg/profile v1.3.0/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
|
||||
github.com/pkg/profile v1.5.0 h1:042Buzk+NhDI+DeSAA62RwJL8VAuZUMQZUjCsRz1Mug=
|
||||
github.com/pkg/profile v1.5.0/go.mod h1:qBsxPvzyUincmltOk6iyRVxHYg4adc0OFOv72ZdLa18=
|
||||
github.com/pkg/xattr v0.4.1 h1:dhclzL6EqOXNaPDWqoeb9tIxATfBSmjqL0b4DpSjwRw=
|
||||
github.com/pkg/xattr v0.4.1/go.mod h1:W2cGD0TBEus7MkUgv0tNZ9JutLtVO3cXu+IBRuHqnFs=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
@@ -355,6 +357,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953 h1:oBvgW8IvwF278gJ3R4hH0gD3ZeJxjwBXVIScRR0dRc8=
|
||||
github.com/posener/complete v1.2.2-0.20190702141536-6ffe496ea953/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E=
|
||||
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
|
||||
github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM=
|
||||
@@ -624,6 +628,8 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
Reference in New Issue
Block a user