Implement cluster-wide in-place updates (#8070)

This PR is a breaking change and also deprecates
`minio update` command, from this release onwards
all users are advised to just use `mc admin update`
This commit is contained in:
Harshavardhana
2019-08-27 11:37:47 -07:00
committed by GitHub
parent 70136fb55b
commit d65a2c6725
15 changed files with 465 additions and 582 deletions

View File

@@ -41,12 +41,13 @@ func main() {
```
| Service operations | Info operations | Healing operations | Config operations | Top operations | IAM operations | Misc |
|:------------------------------------------|:--------------------------------------------|:-------------------|:----------------------------------|:------------------------|:--------------------------------------|:--------------------------------------------------|
| [`ServiceStatus`](#ServiceStatus) | [`ServerInfo`](#ServerInfo) | [`Heal`](#Heal) | [`GetConfig`](#GetConfig) | [`TopLocks`](#TopLocks) | [`AddUser`](#AddUser) | |
| [`ServiceSendAction`](#ServiceSendAction) | [`ServerCPULoadInfo`](#ServerCPULoadInfo) | | [`SetConfig`](#SetConfig) | | [`SetUserPolicy`](#SetUserPolicy) | [`StartProfiling`](#StartProfiling) |
| [`Trace`](#Trace) | [`ServerMemUsageInfo`](#ServerMemUsageInfo) | | [`GetConfigKeys`](#GetConfigKeys) | | [`ListUsers`](#ListUsers) | [`DownloadProfilingData`](#DownloadProfilingData) |
| | | | [`SetConfigKeys`](#SetConfigKeys) | | [`AddCannedPolicy`](#AddCannedPolicy) | |
| Service operations | Info operations | Healing operations | Config operations | Top operations | IAM operations | Misc |
|:------------------------------------|:--------------------------------------------|:-------------------|:----------------------------------|:------------------------|:--------------------------------------|:--------------------------------------------------|
| [`ServiceStatus`](#ServiceStatus) | [`ServerInfo`](#ServerInfo) | [`Heal`](#Heal) | [`GetConfig`](#GetConfig) | [`TopLocks`](#TopLocks) | [`AddUser`](#AddUser) | |
| [`ServiceRestart`](#ServiceRestart) | [`ServerCPULoadInfo`](#ServerCPULoadInfo) | | [`SetConfig`](#SetConfig) | | [`SetUserPolicy`](#SetUserPolicy) | [`StartProfiling`](#StartProfiling) |
| [`ServiceStop`](#ServiceStop) | [`ServerMemUsageInfo`](#ServerMemUsageInfo) | | [`GetConfigKeys`](#GetConfigKeys) | | [`ListUsers`](#ListUsers) | [`DownloadProfilingData`](#DownloadProfilingData) |
| [`ServiceUpdate`](#ServiceUpdate) | | | [`SetConfigKeys`](#SetConfigKeys) | | [`AddCannedPolicy`](#AddCannedPolicy) | |
| [`ServiceTrace`](#ServiceTrace) | | | | | | |
## 1. Constructor
@@ -64,25 +65,7 @@ __Parameters__
| `secretAccessKey` | _string_ | Secret key for the object storage endpoint. |
| `ssl` | _bool_ | Set this value to 'true' to enable secure (HTTPS) access. |
## 2. Admin API Version
<a name="VersionInfo"></a>
### VersionInfo() (AdminAPIVersionInfo, error)
Fetch server's supported Administrative API version.
__Example__
``` go
info, err := madmClnt.VersionInfo()
if err != nil {
log.Fatalln(err)
}
log.Printf("%s\n", info.Version)
```
## 3. Service operations
## 2. Service operations
<a name="ServiceStatus"></a>
### ServiceStatus() (ServiceStatusMetadata, error)
@@ -111,25 +94,73 @@ Fetch service status, replies disk space used, backend type and total disks offl
```
<a name="ServiceSendAction"></a>
### ServiceSendAction(act ServiceActionValue) (error)
Sends a service action command to service - possible actions are restarting and stopping the server.
<a name="ServiceRestart"></a>
### ServiceRestart() error
Sends a service action restart command to MinIO server.
__Example__
```go
// To restart the service, restarts all servers in the cluster.
err := madmClnt.ServiceRestart()
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
```
```go
// to restart
st, err := madmClnt.ServiceSendAction(ServiceActionValueRestart)
// or to stop
// st, err := madmClnt.ServiceSendAction(ServiceActionValueStop)
if err != nil {
log.Fatalln(err)
}
log.Printf("Success")
```
<a name="ServiceStop"></a>
### ServiceStop() error
Sends a service action stop command to MinIO server.
## 4. Info operations
__Example__
```go
// To stop the service, stops all servers in the cluster.
err := madmClnt.ServiceStop()
if err != nil {
log.Fatalln(err)
}
log.Println("Success")
```
<a name="ServiceUpdate"></a>
### ServiceUpdate() (ServiceUpdateStatus, error)
Sends a service action update command to MinIO server, to update MinIO server to latest release.
__Example__
```go
// To update the service, update and restarts all the servers in the cluster.
us, err := madmClnt.ServiceUpdate()
if err != nil {
log.Fatalln(err)
}
if us.CurrentVersion != us.UpdatedVersion {
log.Printf("Updated server version from %s to %s successfully", us.CurrentVersion, us.UpdatedVersion)
}
```
<a name="ServiceTrace"></a>
### ServiceTrace(allTrace bool, doneCh <-chan struct{}) <-chan TraceInfo
Enable HTTP request tracing on all nodes in a MinIO cluster
__Example__
``` go
doneCh := make(chan struct{})
defer close(doneCh)
// listen to all trace including internal API calls
allTrace := true
// Start listening on all trace activity.
traceCh := madmClnt.ServiceTrace(allTrace, doneCh)
for traceInfo := range traceCh {
fmt.Println(traceInfo.String())
}
```
## 3. Info operations
<a name="ServerInfo"></a>
### ServerInfo() ([]ServerInfo, error)
@@ -262,7 +293,7 @@ Fetches Mem utilization for all cluster nodes. Returned value is in Bytes.
| `mem.Usage.Mem` | _uint64_ | The total number of bytes obtained from the OS |
| `mem.Usage.Error` | _string_ | Error (if any) encountered while accesing the CPU info |
## 6. Heal operations
## 5. Heal operations
<a name="Heal"></a>
### Heal(bucket, prefix string, healOpts HealOpts, clientToken string, forceStart bool, forceStop bool) (start HealStartSuccess, status HealTaskStatus, err error)
@@ -327,7 +358,7 @@ __Example__
| `DiskInfo.AvailableOn` | _[]int_ | List of disks on which the healed entity is present and healthy |
| `DiskInfo.HealedOn` | _[]int_ | List of disks on which the healed entity was restored |
## 7. Config operations
## 6. Config operations
<a name="GetConfig"></a>
### GetConfig() ([]byte, error)
@@ -405,7 +436,7 @@ __Example__
log.Println("New configuration successfully set")
```
## 8. Top operations
## 7. Top operations
<a name="TopLocks"></a>
### TopLocks() (LockEntries, error)
@@ -427,7 +458,7 @@ __Example__
log.Println("TopLocks received successfully: ", string(out))
```
## 9. IAM operations
## 8. IAM operations
<a name="AddCannedPolicy"></a>
### AddCannedPolicy(policyName string, policy string) error
@@ -483,7 +514,7 @@ __Example__
}
```
## 10. Misc operations
## 9. Misc operations
<a name="StartProfiling"></a>
### StartProfiling(profiler string) error
@@ -537,22 +568,3 @@ __Example__
log.Println("Profiling data successfully downloaded.")
```
<a name="Trace"></a>
### Trace(allTrace bool,doneCh <-chan struct{}) <-chan TraceInfo
Enable HTTP request tracing on all nodes in a MinIO cluster
__Example__
``` go
doneCh := make(chan struct{})
defer close(doneCh)
// listen to all trace including internal API calls
allTrace := true
// Start listening on all trace activity.
traceCh := madmClnt.Trace(allTrace,doneCh)
for traceInfo := range traceCh {
fmt.Println(traceInfo.String())
}
log.Println("Success")
```