This repository was archived by the owner on Apr 15, 2025. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork55
Add more cmds to cli#99
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
6 commits Select commitHold shift + click to select a range
6aa0f3e Add get index mappings
hoenn2111da6 Add recovery cmd to cli
hoenna586335 Add hotthreads cmd to cli
hoenndca3b7b Standardize optional help text in new commands
hoenn4058dbb Remove unnecessary recovery cmd, shards has a subcmd for this
hoenncdef137 Update README with new usage
hoennFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Add recovery cmd to cli
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commit2111da6a37b4df65bfdad84eb1e7cc1beeb1112c
There are no files selected for viewing
51 changes: 51 additions & 0 deletionspkg/cli/recovery.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| package cli | ||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
| var nodesToCheckRecovery []string | ||
| func init() { | ||
| cmdShardRecovery.Flags().StringArrayVarP(&nodesToCheckRecovery, "nodes", "n", []string{}, "Elasticsearch nodes to view shard recovery progress (optional, omitted will include all nodes)") | ||
| rootCmd.AddCommand(cmdShardRecovery) | ||
| } | ||
| var cmdShardRecovery = &cobra.Command{ | ||
| Use: "recovery", | ||
| Short: "Display the recovery progress of shards.", | ||
| Long: `Show the details regarding shard recovery operations across a set of cluster nodes.`, | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| v := getClient() | ||
| recovery, err := v.GetShardRecovery(nodesToCheckRecovery, true) | ||
| if err != nil { | ||
| fmt.Printf("Error getting shard recovery details: %s\n", err) | ||
| os.Exit(1) | ||
| } | ||
| header := []string{"Index", "Shard", "Time", "Source", "Target", "Bytes %", "Est Remaining"} | ||
| var rows [][]string | ||
| for _, shard := range recovery { | ||
| remaining, _ := shard.TimeRemaining() | ||
| row := []string{ | ||
| shard.Index, | ||
| shard.Shard, | ||
| shard.Time, | ||
| shard.SourceNode, | ||
| shard.TargetNode, | ||
| shard.BytesPercent, | ||
| remaining.String(), | ||
| } | ||
| rows = append(rows, row) | ||
| } | ||
| table := renderTable(rows, header) | ||
| fmt.Println(table) | ||
| }, | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.