1
0
mirror of https://github.com/minio/mc.git synced 2025-11-10 13:42:32 +03:00

Fix admin help messages and docs (#2884)

This commit is contained in:
Harshavardhana
2019-09-06 10:07:30 -07:00
committed by GitHub
parent 22ab93da0f
commit 5fc35b6682
17 changed files with 127 additions and 68 deletions

View File

@@ -34,7 +34,7 @@ const logTimeFormat string = "15:04:05 MST 01/02/2006"
var adminConsoleFlags = []cli.Flag{ var adminConsoleFlags = []cli.Flag{
cli.IntFlag{ cli.IntFlag{
Name: "limit, l", Name: "limit, l",
Usage: "Show last n log entries", Usage: "show last n log entries",
Value: 10, Value: 10,
}, },
} }
@@ -47,20 +47,20 @@ var adminConsoleCmd = cli.Command{
Flags: append(adminConsoleFlags, globalFlags...), Flags: append(adminConsoleFlags, globalFlags...),
HideHelpCommand: true, HideHelpCommand: true,
CustomHelpTemplate: `NAME: CustomHelpTemplate: `NAME:
{{.HelpName}} - {{.Usage}} {{.HelpName}} - {{.Usage}}
USAGE: USAGE:
{{.HelpName}} [FLAGS] TARGET {{.HelpName}} [FLAGS] TARGET [NODENAME]
FLAGS: FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Show console logs for a MinIO server with alias 'play' 1. Show console logs for a MinIO server with alias 'play'
$ {{.HelpName}} play $ {{.HelpName}} play
2. Show last 5 log entries for node 'node1' on MinIO server with alias 'cluster1' 2. Show last 5 log entries for node 'node1' on MinIO server with alias 'cluster1'
$ {{.HelpName}} cluster1 node1 --limit 5 $ {{.HelpName}} --limit 5 cluster1 node1
`, `,
} }
@@ -144,7 +144,7 @@ func mainAdminConsole(ctx *cli.Context) error {
fatalIf(errInvalidArgument().Trace(ctx.Args()...), "please set a proper limit, for example: '--limit 5' to display last 5 logs, omit this flag to display all available logs") fatalIf(errInvalidArgument().Trace(ctx.Args()...), "please set a proper limit, for example: '--limit 5' to display last 5 logs, omit this flag to display all available logs")
} }
} }
// Create a new Minio Admin Client // Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL) client, err := newAdminClient(aliasedURL)
if err != nil { if err != nil {
fatalIf(err.Trace(aliasedURL), "Cannot initialize admin client.") fatalIf(err.Trace(aliasedURL), "Cannot initialize admin client.")

View File

@@ -36,7 +36,7 @@ FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Disable group 'allcents': 1. Disable group 'allcents'.
$ {{.HelpName}} myminio allcents $ {{.HelpName}} myminio allcents
`, `,
} }

View File

@@ -42,9 +42,8 @@ FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Enable group 'allcents': 1. Enable group 'allcents'.
$ {{.HelpName}} myminio allcents $ {{.HelpName}} myminio allcents
`, `,
} }

View File

@@ -39,7 +39,7 @@ FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Get info on group 'allcents': 1. Get info on group 'allcents'.
$ {{.HelpName}} myminio allcents $ {{.HelpName}} myminio allcents
`, `,
} }

View File

@@ -33,13 +33,13 @@ var adminGroupListCmd = cli.Command{
{{.HelpName}} - {{.Usage}} {{.HelpName}} - {{.Usage}}
USAGE: USAGE:
{{.HelpName}} TARGET GROUPNAME {{.HelpName}} TARGET
FLAGS: FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. List groups: 1. List all groups.
$ {{.HelpName}} myminio $ {{.HelpName}} myminio
`, `,
} }

View File

@@ -34,15 +34,16 @@ var adminGroupRemoveCmd = cli.Command{
{{.HelpName}} - {{.Usage}} {{.HelpName}} - {{.Usage}}
USAGE: USAGE:
{{.HelpName}} TARGET GROUPNAME [MEMBERS...] {{.HelpName}} TARGET GROUPNAME [USERNAMES...]
FLAGS: FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Remove members 'tencent' and 'fivecent' from group 'allcents': 1. Remove members 'tencent' and 'fivecent' from group 'allcents'.
$ {{.HelpName}} myminio allcents tencent fivecent $ {{.HelpName}} myminio allcents tencent fivecent
2. Remove group 'allcents':
2. Remove group 'allcents'.
$ {{.HelpName}} myminio allcents $ {{.HelpName}} myminio allcents
`, `,
} }

View File

@@ -81,7 +81,7 @@ FLAGS:
{{end}} {{end}}
SCAN MODES: SCAN MODES:
normal (default): Heal objects which are missing on one or more disks. normal (default): Heal objects which are missing on one or more disks.
deep : Heal objects which are missing on one or more disks. Also heal objects with silent data corruption. deep : Heal objects which are missing or with silent data corruption on one or more disks.
EXAMPLES: EXAMPLES:
1. To format newly replaced disks in a MinIO server with alias 'myminio' 1. To format newly replaced disks in a MinIO server with alias 'myminio'

View File

@@ -53,8 +53,7 @@ FLAGS:
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Get server CPU information of the 'play' MinIO server. 1. Get server CPU information of the 'play' MinIO server.
$ {{.HelpName}} play/ $ {{.HelpName}} play/
`, `,
} }

View File

@@ -54,8 +54,7 @@ FLAGS:
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Get server CPU information of the 'play' MinIO server. 1. Get server CPU information of the 'play' MinIO server.
$ {{.HelpName}} play/ $ {{.HelpName}} play/
`, `,
} }

View File

@@ -49,8 +49,7 @@ FLAGS:
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Get server information of the 'play' MinIO server. 1. Get server information of the 'play' MinIO server.
$ {{.HelpName}} play/ $ {{.HelpName}} play/
`, `,
} }

View File

@@ -50,7 +50,7 @@ var adminTraceFlags = []cli.Flag{
var adminTraceCmd = cli.Command{ var adminTraceCmd = cli.Command{
Name: "trace", Name: "trace",
Usage: "show http trace for minio server", Usage: "show http trace for MinIO server",
Action: mainAdminTrace, Action: mainAdminTrace,
Before: setGlobalsFromContext, Before: setGlobalsFromContext,
Flags: append(adminTraceFlags, globalFlags...), Flags: append(adminTraceFlags, globalFlags...),
@@ -65,12 +65,12 @@ FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}
EXAMPLES: EXAMPLES:
1. Show console trace for a Minio server with alias 'play' 1. Show console trace for a MinIO server with alias 'play'
$ {{.HelpName}} play -v -a $ {{.HelpName}} -v -a play
2. Show trace only for failed requests for a Minio server with alias 'myminio' 2. Show trace only for failed requests for a MinIO server with alias 'myminio'
$ {{.HelpName}} myminio -v -e $ {{.HelpName}} -v -e myminio
`, `,
} }
const timeFormat = "15:04:05.000" const timeFormat = "15:04:05.000"
@@ -111,7 +111,7 @@ func mainAdminTrace(ctx *cli.Context) error {
for _, c := range colors { for _, c := range colors {
console.SetColor(fmt.Sprintf("Node%d", c), color.New(c)) console.SetColor(fmt.Sprintf("Node%d", c), color.New(c))
} }
// Create a new Minio Admin Client // Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL) client, err := newAdminClient(aliasedURL)
if err != nil { if err != nil {
fatalIf(err.Trace(aliasedURL), "Cannot initialize admin client.") fatalIf(err.Trace(aliasedURL), "Cannot initialize admin client.")

View File

@@ -39,6 +39,12 @@ var adminUserAddCmd = cli.Command{
USAGE: USAGE:
{{.HelpName}} TARGET ACCESSKEY SECRETKEY {{.HelpName}} TARGET ACCESSKEY SECRETKEY
ACCESSKEY:
Also called as username.
SECRETKEY:
Also called as password.
FLAGS: FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}
{{end}} {{end}}

View File

@@ -33,7 +33,7 @@ var adminUserInfoCmd = cli.Command{
{{.HelpName}} - {{.Usage}} {{.HelpName}} - {{.Usage}}
USAGE: USAGE:
{{.HelpName}} TARGET ACCESSKEY {{.HelpName}} TARGET USERNAME
FLAGS: FLAGS:
{{range .VisibleFlags}}{{.}} {{range .VisibleFlags}}{{.}}

View File

@@ -97,7 +97,7 @@ EXAMPLES:
1. Run a query on a set of objects recursively on AWS S3. 1. Run a query on a set of objects recursively on AWS S3.
$ {{.HelpName}} --recursive --query "select * from S3Object" s3/personalbucket/my-large-csvs/ $ {{.HelpName}} --recursive --query "select * from S3Object" s3/personalbucket/my-large-csvs/
2. Run a query on an object on Minio. 2. Run a query on an object on MinIO.
$ {{.HelpName}} --query "select count(s.power) from S3Object" myminio/iot-devices/power-ratio.csv $ {{.HelpName}} --query "select count(s.power) from S3Object" myminio/iot-devices/power-ratio.csv
3. Run a query on an encrypted object with customer provided keys. 3. Run a query on an encrypted object with customer provided keys.

View File

@@ -3,14 +3,18 @@
MinIO Client (mc) provides `admin` sub-command to perform administrative tasks on your MinIO deployments. MinIO Client (mc) provides `admin` sub-command to perform administrative tasks on your MinIO deployments.
``` ```
service restart or stop all MinIO servers service restart and stop all MinIO servers
update updates all MinIO servers update update all MinIO servers
info display MinIO server information info display MinIO server information
user manage users user manage users
policy manage canned policies group manage groups
config manage configuration file policy manage policies defined in the MinIO server
heal heal disks, buckets and objects on MinIO server config manage configuration file
top provide top like statistics for MinIO heal heal disks, buckets and objects on MinIO server
profile generate profile data for debugging purposes
top provide top like statistics for MinIO
trace show http trace for minio server
console show console logs for MinIO server
``` ```
## 1. Download MinIO Client ## 1. Download MinIO Client
@@ -126,7 +130,6 @@ mc admin info server minio
MEM usage MEM usage
current 602 MiB current 602 MiB
historic 448 MiB historic 448 MiB
``` ```
## 5. Everyday Use ## 5. Everyday Use
@@ -260,17 +263,21 @@ Skip SSL certificate verification.
## 7. Commands ## 7. Commands
| | | |
|:--------------------------------------------------------------------| |:-----------------------------------------------------------------------|
| [**service** - restart and stop all MinIO servers](#service) | | [**service** - restart and stop all MinIO servers](#service) |
| [**update** - updates all MinIO servers](#update) | | [**update** - updates all MinIO servers](#update) |
| [**info** - display MinIO server information](#info) | | [**info** - display MinIO server information](#info) |
| [**user** - manage users](#user) | | [**user** - manage users](#user) |
| [**group** - manage groups](#group) | | [**group** - manage groups](#group) |
| [**policy** - manage canned policies](#policy) | | [**policy** - manage canned policies](#policy) |
| [**config** - manage server configuration file](#config) | | [**config** - manage server configuration file](#config) |
| [**heal** - heal disks, buckets and objects on MinIO server](#heal) | | [**heal** - heal disks, buckets and objects on MinIO server](#heal) |
| [**top** - provide top like statistics for MinIO](#top) | | [**profile** - generate profile data for debugging purposes](#profile) |
| [**top** - provide top like statistics for MinIO](#top) |
| [**trace** - show http trace for MinIO server](#trace) |
| [**console** - show console logs for MinIO server](#console) |
<a name="update"></a> <a name="update"></a>
### Command `update` - updates all MinIO servers ### Command `update` - updates all MinIO servers
@@ -578,6 +585,23 @@ mc admin heal -r myminio/mybucket
mc admin heal -r myminio/mybucket/myobjectprefix mc admin heal -r myminio/mybucket/myobjectprefix
``` ```
<a name="profile"></a>
### Command `profile` - generate profile data for debugging purposes
```
NAME:
mc admin profile - generate profile data for debugging purposes
COMMANDS:
start start recording profile data
stop stop and download profile data
```
Start CPU profiling
```
mc admin profile start --type cpu myminio/
```
<a name="top"></a> <a name="top"></a>
### Command `top` - provide top like statistics for MinIO ### Command `top` - provide top like statistics for MinIO
NOTE: This command is only applicable for a distributed MinIO setup. It is not supported on single node and gateway deployments. NOTE: This command is only applicable for a distributed MinIO setup. It is not supported on single node and gateway deployments.
@@ -586,12 +610,8 @@ NOTE: This command is only applicable for a distributed MinIO setup. It is not s
NAME: NAME:
mc admin top - provide top like statistics for MinIO mc admin top - provide top like statistics for MinIO
FLAGS:
--help, -h show help
COMMANDS: COMMANDS:
locks Get a list of the 10 oldest locks on a MinIO cluster. locks Get a list of the 10 oldest locks on a MinIO cluster.
``` ```
*Example: Get a list of the 10 oldest locks on a distributed MinIO cluster, where 'myminio' is the MinIO cluster alias.* *Example: Get a list of the 10 oldest locks on a distributed MinIO cluster, where 'myminio' is the MinIO cluster alias.*
@@ -601,18 +621,21 @@ mc admin top locks myminio
``` ```
<a name="trace"></a> <a name="trace"></a>
### Command `trace` - Display Minio server http trace ### Command `trace` - Show http trace for MinIO server
`trace` command displays server http trace of one or many Minio servers (under distributed cluster) `trace` command displays server http trace of one or all MinIO servers (under distributed cluster)
```sh ```sh
NAME: NAME:
mc admin trace - get minio server http trace mc admin trace - show http trace for MinIO server
FLAGS: FLAGS:
--help, -h show help --verbose, -v print verbose trace
--all, -a trace all traffic (including internode traffic between MinIO servers)
--errors, -e trace failed requests only
--help, -h show help
``` ```
*Example: Display Minio server http trace.* *Example: Display MinIO server http trace.*
```sh ```sh
mc admin trace myminio mc admin trace myminio
@@ -621,7 +644,7 @@ mc admin trace myminio
172.16.238.1 Host: 172.16.238.3:9000 172.16.238.1 Host: 172.16.238.3:9000
172.16.238.1 X-Amz-Date: 20190123T231705Z 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 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/v6.0.8 mc/2019-01-23T23:15:38Z
172.16.238.1 X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 172.16.238.1 X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
172.16.238.1 172.16.238.1
172.16.238.1 <BODY> 172.16.238.1 <BODY>
@@ -633,7 +656,38 @@ mc admin trace myminio
172.16.238.1 Accept-Ranges: bytes 172.16.238.1 Accept-Ranges: bytes
172.16.238.1 Content-Security-Policy: block-all-mixed-content 172.16.238.1 Content-Security-Policy: block-all-mixed-content
172.16.238.1 Content-Type: application/xml 172.16.238.1 Content-Type: application/xml
172.16.238.1 Server: Minio/DEVELOPMENT.2019-01-23T23-14-14Z 172.16.238.1 Server: MinIO/RELEASE.2019-09-05T23-24-38Z
172.16.238.1 Vary: Origin 172.16.238.1 Vary: Origin
... ...
``` ```
<a name="console"></a>
### Command `console` - show console logs for MinIO server
`console` command displays server logs of one or all MinIO servers (under distributed cluster)
```sh
NAME:
mc admin console - show console logs for MinIO server
FLAGS:
--limit value, -l value show last n log entries (default: 10)
--help, -h show help
```
*Example: Display MinIO server http trace.*
```sh
mc admin console myminio
API: SYSTEM(bucket=images)
Time: 22:48:06 PDT 09/05/2019
DeploymentID: 6faeded5-5cf3-4133-8a37-07c5d500207c
RequestID: <none>
RemoteHost: <none>
UserAgent: <none>
Error: ARN 'arn:minio:sqs:us-east-1:1:webhook' not found
4: cmd/notification.go:1189:cmd.readNotificationConfig()
3: cmd/notification.go:780:cmd.(*NotificationSys).refresh()
2: cmd/notification.go:815:cmd.(*NotificationSys).Init()
1: cmd/server-main.go:375:cmd.serverMain()
```

3
go.mod
View File

@@ -44,4 +44,5 @@ require (
) )
replace github.com/gorilla/rpc v1.2.0+incompatible => github.com/gorilla/rpc v1.2.0 replace github.com/gorilla/rpc v1.2.0+incompatible => github.com/gorilla/rpc v1.2.0
replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999
replace git.apache.org/thrift.git => github.com/apache/thrift v0.12.0

1
go.sum
View File

@@ -43,6 +43,7 @@ github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20170925032315-6fe16293d6b7/go.mod h1
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5 h1:nWDRPCyCltiTsANwC/n3QZH7Vww33Npq9MKqlwRzI/c= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5 h1:nWDRPCyCltiTsANwC/n3QZH7Vww33Npq9MKqlwRzI/c=
github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8= github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs= github.com/apache/thrift v0.12.0 h1:pODnxUFNcjP9UTLZGTdeh+j16A8lJbRvD3rOtrk/7bs=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/araddon/gou v0.0.0-20190110011759-c797efecbb61/go.mod h1:ikc1XA58M+Rx7SEbf0bLJCfBkwayZ8T5jBo5FXK8Uz8= github.com/araddon/gou v0.0.0-20190110011759-c797efecbb61/go.mod h1:ikc1XA58M+Rx7SEbf0bLJCfBkwayZ8T5jBo5FXK8Uz8=